@comandeer/cli-spinner
v1.0.2
Published
Simple CLI spinner
Downloads
48
Readme
@comandeer/cli-spinner
Super simple CLI spinner.
Installation
npm install @comandeer/cli-spinner --save
Usage
import Spinner from '@comandeer/cli-spinner';
const spinner = new Spinner( {
label: 'Working…'
} );
await spinner.show();
//do something
await spinner.hide();
Configuration
You can configure the spinner by passing options via options
object in the constructor:
const spinner = new Spinner( options );
The list of available options is presented below:
| Name | Type | Default value | Description |
| ---------- | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| stdout
| Stream
| process.stderr
| Stream to which the spinner will be outputted. |
| label
| string
| ''
| Additional text label that will be displayed next to the spinner. |
| spinner
| Array<string>
| See src/defaultSpinner.js
| An array containing frames that will be used to animate the spinner. |
| interval
| number
| 80 | Indicates how often frames of the spinner should be changed. |
Why should I use it instead of x?
The truth is: you probably shouldn't. This package was created because I couldn't stand the API of gauge
and ora
didn't work for me for some reason. As I have quite severe NIH syndrome, I decided to create my own, very naive implementation of a CLI spinner.
So if you look for a battle-tested solution and don't mind more convoluted API, use gauge
. If you prefer a battle-tested solution but with really user-friendly API, use ora
. If for some reason these solutions don't work for you, you probably still shouldn't use this package.
License
See LICENSE file for details.