Skip to content

Latest commit

 

History

History
291 lines (207 loc) · 9.89 KB

api.md

File metadata and controls

291 lines (207 loc) · 9.89 KB

Classes

Progress : Progress

Progress bar class for command line interfaces.

Spinner : Spinner

Represents a spinner for command line interfaces.

Members

spinner

A singleton instance of the Spinner class. Useful for quick access when only one spinner is needed.

Progress : Progress

Progress bar class for command line interfaces.

Kind: global class

new Progress(opts)

Creates a new Progress instance.

Param Type Default Description
opts Object The options for the progress bar.
[opts.etaBuffer] number 2 The buffer for ETA calculation.
[opts.clearOnComplete] boolean false Whether to clear the progress bar on completion.
[opts.preset] string "'shades_classic'" The preset style for the progress bar.
[opts.total] number 100 The total value of the progress bar.

progress.total ⇒ number

Gets the total value of the progress bar.

Kind: instance property of Progress
Returns: number - The total value.

progress.total

Sets the total value of the progress bar.

Kind: instance property of Progress

Param Type Description
total number The total value to be set.

progress.start([start])

Starts the progress bar.

Kind: instance method of Progress

Param Type Default Description
[start] number 0 The initial value from which to start.

progress.increment(delta, [payload])

Increments the current value of the progress bar.

Kind: instance method of Progress

Param Type Description
delta number The value by which to increment.
[payload] Object Additional payload information.

progress.update(value, [payload])

Updates the current value of the progress bar.

Kind: instance method of Progress

Param Type Description
value number The value to which the progress bar will be updated.
[payload] Object Additional payload information.

progress.updateETA()

Updates the estimated time of arrival (ETA).

Kind: instance method of Progress

progress.setTotal(totalValue)

Sets the total value of the progress bar.

Kind: instance method of Progress

Param Type Description
totalValue number The total value to be set.

progress.stop()

Stops the progress bar and updates it to its total value.

Kind: instance method of Progress

Progress.Progress ⇒ Progress

Static getter for the Progress class itself. This can be useful when you need a reference to the class from a static method.

Kind: static property of Progress
Returns: Progress - The Progress class.

Progress.cliProgress ⇒ cliProgress

Static getter for the cli-progress library. This allows access to the cli-progress library from the Progress class without needing to import it separately.

Kind: static property of Progress
Returns: cliProgress - The cli-progress library.

Spinner : Spinner

Represents a spinner for command line interfaces.

Kind: global class

new Spinner([opts])

Creates an instance of Spinner.

Param Type Default Description
[opts] Object {} The options for the spinner.
[opts.id] string "'spinner'" The unique identifier for the spinner.
[opts.color] string "'green'" The color of the spinner.
[opts.succeedColor] string The color when spinner succeeds. Defaults to opts.color.
[opts.failColor] string "'redBright'" The color when spinner fails.
[opts.spinner] string "'aesthetic'" The spinner style.

spinner.text

Sets the text of the spinner.

Kind: instance property of Spinner

Param Type Description
text string The new text to display.

spinner.start(text, [color])

Starts the spinner with provided text and color.

Kind: instance method of Spinner

Param Type Description
text string The text to display alongside the spinner.
[color] string The color of the spinner. Defaults to the spinner's color.

spinner.update(text, [color])

Updates the spinner's text and color.

Kind: instance method of Spinner

Param Type Description
text string The new text to display.
[color] string The new color of the spinner. Defaults to the spinner's color.

spinner.succeed(text, [color])

Marks the spinner as successful.

Kind: instance method of Spinner

Param Type Description
text string The success message to display.
[color] string The color of the success message. Defaults to the spinner's succeedColor.

spinner.fail(text, [color])

Marks the spinner as failed.

Kind: instance method of Spinner

Param Type Description
text string The failure message to display.
[color] string The color of the failure message. Defaults to the spinner's failColor.

Spinner.spinner ⇒ Spinner

Creates a new instance of Spinner.

Kind: static property of Spinner
Returns: Spinner - A new Spinner instance.

Spinner.Spinner ⇒ Spinner

Returns the Spinner class.

Kind: static property of Spinner
Returns: Spinner - The Spinner class.

Spinner.Spinnies ⇒ Spinnies

Returns the Spinnies class.

Kind: static property of Spinner
Returns: Spinnies - The Spinnies class.

Spinner.spins ⇒ Spinner

Gets the singleton instance of the Spinner.

Kind: static property of Spinner
Returns: Spinner - The singleton instance of the Spinner.

Spinner.spin(opts) ⇒ Spinner

Creates and returns a new spinner with provided options.

Kind: static method of Spinner
Returns: Spinner - A new Spinner instance.

Param Type Description
opts Object The options to create a new spinner.

spinner

A singleton instance of the Spinner class. Useful for quick access when only one spinner is needed.

Kind: global variable