cli-stepper
v0.0.2
Published
A simple CLI stepper for command-line or terminal applications.
Readme
CLI Stepper
A simple CLI stepper for command-line or terminal applications.

Installation
npm install cli-stepperUsage
Basic Usage
import { Stepper } from 'cli-stepper'
const stepper = new Stepper({
// optional configurations
})
// Start a task
stepper.start('Downloading dependencies')
// As same as:
// stepper.pending('Downloading dependencies')
// Task succeeded.
stepper.success('Dependencies downloaded')
// Task failed
stepper.error('Download failed')[!IMPORTANT] Whenever you want to start the next step, you must end the current step by
.success()or.error().
Configuration
The following is the default configuration of the Stepper class.
const stepper = new Stepper({
// Badge that will be displayed before the text in different status
pendingBadge: 'PENDING',
successBadge: 'SUCCESS',
errorBadge: ' ERROR ',
// Color of the badge and text in different status
pendingColor: 'yellow',
successColor: 'green',
errorColor: 'red',
// Whether to display the spinner animation
enableSpinner: true,
// Spinner animation frames, it will be displayed in a loop
spinnerFrames: ['-', '\\', '|', '/'],
// Spinner frame interval(ms)
spinnerInterval: 500,
// Whether to exit the process gracefully when the task is unexpectly interrupted
gracefulExit: false,
// Whether to hide the terminal cursor when the task is pending
hideCursor: true,
})