0.2.1 • Published 3 years ago

@open-tech-world/node-cli-progress v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

@open-tech-world/node-cli-progress

Build CodeFactor npm (scoped)

npm.io

CLI spinner with task progress result.

Installation

Using npm

npm install @open-tech-world/node-cli-progress

Using Yarn

yarn add @open-tech-world/node-cli-progress

Usage

import { cliProgress } from '@open-tech-world/node-cli-progress';

const progress = new cliProgress();
progress.start();
setTimeout(() => {
  progress.update('Downloading');
}, 1000);
progress.done('Download completed!');

API

new cliProgress(options?: Partial\<IOptions>)

It creates a new instance of the cliProgress.

options:

NameTypeDefaultDescription
streamNodeJS.WriteStreamprocess.stderrThe stream to use.

Instance methods:

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.

License

Copyright (c) 2021, Thanga Ganapathy (MIT License).