Skip to content
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

Update color on completed? #178

Open
pbeocanin opened this issue Aug 21, 2018 · 3 comments
Open

Update color on completed? #178

pbeocanin opened this issue Aug 21, 2018 · 3 comments

Comments

@pbeocanin
Copy link

Say I do something like

bar = new ProgressBar(':current/:total :bar :percent :elapseds', {
		total: files.length,
		complete: red,
	});

And then once I'm done, I'd run something like bar.update({ complete: green });, which re-renders the bar, but doesn't change the color. Am I missing something, or is this not supported?

mearns added a commit to mearns/node-progress that referenced this issue Oct 15, 2019
The config method allows the progress bar to be reconfigured at any point, such as from the
callback. Also changed the order so that the callback is called before the final render,
so that the callback can reconfigure the bar for the final render.
@mearns
Copy link

mearns commented Oct 15, 2019

I don't believe this is currently supported: the update method doesn't reconfigure the progress bar, it sets the percent complete (and optionally provides render tokens). You could manually set the config properties on the ProgressBarin the callback, and then force it to re-render, but there are some issues with this (namely, the bar is finalized before the callback, so if you call render again from the callback, it will render on a new line, instead of overwriting the existing line).

I've made some minor changes and added a config method in pull request #193 to support the requested feature, as well as provided an example in examples/update-on-finish.js.

@pbeocanin
Copy link
Author

Yeah I don't think it's a huge deal, but it would be nice to visually indicate it's done, so I'm definitely going to try out the pull request directly, thank you!

@zhizhuxialiwen
Copy link

I think that it updates progress bar , then it updates color.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants