Progress Bar
Last updated
Last updated
When writing a Task that needs to iterate some predefined amount of work that might take some time, you can now tap into the Progress Bars in CommandBox easily for your own purposes.
There are two different progress bars in CommandBox. One specifically for downloading files, and a generic one.
Here is how you can download a file in a Task Runner and have a progress bar animation that contains all the usual data such as download speed and file size. The progressable downloader will automatically take any HTTP proxy settings into account.
Full docs for the Progressable Downloader are here.
You can also use a generic progress bar for any purpose. It is up to you to update the progress bar with the current percentage. If you are inside of an Interactive Job, the progress bar will automatically show at the bottom of the job output.
The currentCount
and totalCount
parameters to the update()
method are optional. They will show in the output only if you provide them.
You can remove the progress bar from the screen at any time with clear()
.
You can show the bar again at any percentage simply by calling the update()
method. No need to initialize anything. The progress bar object carries no state.