CLI spinner with task progress result.
Using npm
npm install @open-tech-world/node-cli-progress
Using Yarn
yarn add @open-tech-world/node-cli-progress
import { cliProgress } from '@open-tech-world/node-cli-progress';
const progress = new cliProgress();
progress.start();
setTimeout(() => {
progress.update('Downloading');
}, 1000);
progress.done('Download completed!');
new cliProgress(options?: Partial<IOptions>)
It creates a new instance of the cliProgress.
options:
Name | Type | Default | Description |
---|---|---|---|
stream | NodeJS.WriteStream | process.stderr | The stream to use. |
start(text?: string)
This method starts the spinner with optional text
.
The default text is Loading
.
update(text: string)
This method updates the current text
with the given text
.
done(text?: string)
This method stops the spinner and mark the task as success
with optional text
.
fail(text?: string)
This method stops the spinner and mark the task as failed
with optional text
.
warn(text?: string)
This method stops the spinner and mark the task as warning
with optional text
.
info(text?: string)
This method stops the spinner and mark the task as info
with optional text
.
Copyright (c) 2021, Thanga Ganapathy (MIT License).