Skip to content

[Console] Fix progress bar formatting when max is set on start() and some other edge cases #16196

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

Merged
merged 2 commits into from
Oct 11, 2015

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Oct 11, 2015

Q A
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

Besides what #16149 fixed, it also fixes the case where setFormat() is called before start().

From #16149

When I set max count, by call "ProgressBar::start()", I got invalid progress bar format.

Example code:

$bar = new ProgressBar($output, 100);
$bar->start();
$bar->advance(100);
$bar->finish();

Output:
100/100 [============================] 100%

Example code:

$bar = new ProgressBar($output);
$bar->start(100);
$bar->advance(100);
$bar->finish();

Output:
100 [============================]

@fabpot fabpot force-pushed the format-progress-bar branch from 5c682e8 to e651da4 Compare October 11, 2015 07:42
@fabpot
Copy link
Member Author

fabpot commented Oct 11, 2015

Thank you @vsychov.

@fabpot fabpot merged commit e651da4 into symfony:2.7 Oct 11, 2015
fabpot added a commit that referenced this pull request Oct 11, 2015
…tart() and some other edge cases (vsychov, fabpot)

This PR was merged into the 2.7 branch.

Discussion
----------

[Console] Fix progress bar formatting when max is set on start() and some other edge cases

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Besides what #16149 fixed, it also fixes the case where `setFormat()` is called before `start()`.

From #16149

When I set max count, by call "ProgressBar::start()", I got invalid progress bar format.

Example code:
```php
$bar = new ProgressBar($output, 100);
$bar->start();
$bar->advance(100);
$bar->finish();
```
Output:
 100/100 [============================] 100%

Example code:
```php
$bar = new ProgressBar($output);
$bar->start(100);
$bar->advance(100);
$bar->finish();
```
Output:
 100 [============================]

Commits
-------

e651da4 [Console] fixed progress bar format on edge cases
3cbfa63 fix bug with set max count, by start method in progress bar
@fabpot fabpot mentioned this pull request Oct 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants