Awesome
Usage
A simple CLI progress bar, inspired by Gauge.
var ProgressBar = require('cli-progress-bar')
var bar = new ProgressBar()
bar.show("Foo", 0.75)
bar.pulse("bar")
bar.hide()
API
var bar = new ProgressBar([options])
- options – (optional) An option object.
The options object can have the following properties, all of which are optional:
- theme: defaults to
ProgressBar.themes.unicode
if the terminal supports unicode according to [cli-character-set], otherwise it defaults toProgressBar.themes.ascii
orProgressBar.themes.cp437
for Windows. - width: sets a desired width (in columns) of the entire progress indicator, not just the bar. The progress bar itself will take up about half of the column width. Additional text may overflow the desired with. By default it uses the number of available columns of the TTY.
bar.show([name, [completed]])
- name – (optional) The name of the current thing contributing to progress. Defaults to the last value used, or "".
- completed – (optional) The portion completed as a value between 0 and 1. Defaults to the last value used, or 0.
bar.hide()
Removes the progress bar from the terminal.
bar.pulse([name])
- name – (optional) The specific thing that triggered this pulse
Spins the spinner in the progress bar to show output. If name is included then
it will be combined with the last name passed to bar.show()
using the
subsection property of the theme (typically a right facing arrow).