-
Notifications
You must be signed in to change notification settings - Fork 653
feat(cli/unstable): add ProgressBar
start()
method
#6408
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
base: main
Are you sure you want to change the base?
feat(cli/unstable): add ProgressBar
start()
method
#6408
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6408 +/- ##
==========================================
- Coverage 95.08% 95.07% -0.01%
==========================================
Files 576 576
Lines 43337 43347 +10
Branches 6466 6469 +3
==========================================
+ Hits 41208 41214 +6
- Misses 2089 2093 +4
Partials 40 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
The start method should allow for the options to be optionally provided again in case the user wants to change values, like the max. This allows it to be reused later down the line. |
Instead of allowing const progressBar = new ProgressBar()
progressBar.start()
...
progressBar.stop()
...
progressBar.max = 100
progressBar.start()
... The other benefit of that is that a public WDYT? |
I think some properties like value, max, barLength and fmt could make sense, but other properties like clear and keepOpen could break things/ have no effect. Looking at the current state of the code even though one can call start and stop multiple times, the progress bar can't be reused. The interval ID isn't cleared for a second round and the writer is closed when stop is called, possibly closing the writable passed in. |
I'm not in favor of this change as the added complexity is not small, but this doesn't support any new practical scenario. |
Do you mean the addition of I would argue that there is a small complexity addition for the first if the progress bar resets when calling |
As @BlackAsLight pointed, this introduces a new bugs related to start method. Because |
I'll have another look after some of the other PRs have landed. I imagine some of the mentioned issues add not too much complexity, some are even already implemented in |
There are also APIs which start the main processing at the constructor such as |
Also alignment to the web platform api shouldn't be the goal in my view. It should be only supplementary for design decisions when there are equally possible designs. If the alignment to web apis causes additional unnecessary complexity, then I think we should avoid it. |
This PR adds
start()
method toProgressBar
. This in order to align to Spinner and to allow instantiation ofProgressBar
before usage.