-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Progress helper enhancements #7300
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
did you test on Windows ? |
I don't have a Windows VM, is there an easy way to test on Windows? |
I will test it ASAP |
|
We do not require mbstring, but we use it optionally when available. See https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Console/Application.php#L784-L794 for instance. |
public function testMultiByteSupport() | ||
{ | ||
if (!function_exists('mb_strlen') || (false === $encoding = mb_detect_encoding('■'))) { | ||
$this->markTestIncomplete('The mbstring extension is needed for multi-byte support'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the test be skipped instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'll update it.
@fabpot is this good to merge? The failed Travis build seems to come from a different component. |
I've submitted a doc change for this PR: symfony/symfony-docs#2342 and added a CHANGELOG entry |
Two enhancements:
setCurrent
method to set the current progress. Rather than advancing by 1 or more steps, sometimes you want to just set the current state. For example if you are downloading a file, and a callback provides you with the current download status. A workaround for this could be to keep track of the previous event, calculate the difference, and advancing by the diff. But it's easier to just set the current progress.Sidenotes:
overwrite
method copied documentation of the Output'swrite
method. The difference is, the overwrite method does not handle an array of messages. I've updated the documentation for this.strlen
to calculate line lengths. This could cause a problem when using multibyte strings. I'd change it tomb_strlen
, but I'm not sure if themb_string
extension is required by Symfony.