-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console] Improve the helpfulness of %remaining% in Progress Bar #49927
New issue
Have a question 8000 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
Comments
That's a good idea, I'm also frustrated by the lack of precision of this remaining time display. The proposed format doesn't tell the unit, what do you think of adding the sub-unit only when the main value has a single digit. Example:
The PR will have to target next minor release branch (2 weeks left for |
The sub unit could be a good solution. Why do you say a new method would be needed? I think just changing the Helper@formatTime method should be fine. |
Depending on how people are using this public function in their code, changing the behavior might break things. In Symfony we are very attentive to provide a smooth upgrade path. I proposed a new method, but the solution can ba a new argument on the existing method. |
I guess there are a few options: One Two Three
With this one the debate would be about the default value for $units. 2 seems a sensible default to me but would be a breaking change, so we may have to go with 1. However then the question is how to modify the number of units within an application. Perhaps That would involve drastically modifying this method to handle options on the key. "One" seems the easiest option to add in the short term. |
Thank you for this issue. |
This PR was merged into the master branch. Discussion ---------- Do not ping stale issues with a linked PR Filters out issues like symfony/symfony#49927 , where a PR already exists to solve it. Commits ------- 1320297 Do not ping stale issues with a linked PR
…mes (maxbeckers) This PR was merged into the 6.4 branch. Discussion ---------- [Console] Add placeholders to ProgressBar for exact times | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #49927 | License | MIT | Doc PR | symfony/symfony-docs#... TBD This is an idea for exact times using ProgressBar based on the idea of `@GromNaN` in the issue #49927. Open to discuss this first way of implementing it. I'll create the docs PR when the feature is agreed and there won't come up any bigger changes. The Idea is to show the exact time in seconds, the ProgressBar will run / is running. Commits ------- b553dd9 [Console] Add Placeholders to ProgressBar for exactly times
Description
At present the remaining time on the progress bar is not that helpful. If the remaining time is between 24 and 47 hours it will just read "1 days remaining".
Similarly if the time remaining is 1 hour 55 minutes, the text will actually display "1 hour remaining".
Obviously this isn't that helpful when planning around a process finishing.
In all my projects I now add this:
With this, when using the format:
%current%/%max% [%bar%] %percent:3s%% %elapsed:6s% taken %remaining:-6s% remaining
, I will get the following:This:
5/169200 [>---------------------------] 0% 5 secs taken 46:59:55 remaining
Instead of this:
5/169200 [>---------------------------] 0% 5 secs taken 1 day remaining
Or in the case of a 1 hour 48 minute process:
This:
5/6500 [>---------------------------] 0% 5 secs taken 01:48:15 remaining
Instead of this:
5/6500 [>---------------------------] 0% 5 secs taken 1 hr remaining
This could be implemented by updating
Symfony\Component\Console\Helper
https://github.com/symfony/console/blob/3582d68a64a86ec25240aaa521ec8bc2342b369b/Helper/Helper.php#L91
To use the same logic as above. Although this would have the side effect of changing all dates. So it would in fact look like this:
5/6500 [>---------------------------] 0% 00:00:05 taken 01:48:15 remaining
I don't have an issue with that, but perhaps it's not desired?
I can create a PR if this is okay, but i've never contributed to Symfony before so figured I would start by creating an issue.
Example
No response
The text was updated successfully, but these errors were encountered: