Skip to content

ameerthehacker/deno-cli-spinners

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLI Spinners for Deno

Awesome deno terminal spinners

example screenshot

This package is inspired from ora and cli-spinners

Usage

import Spinner from 'https://deno.land/x/cli_spinners@v0.0.2/mod.ts';

const spinner = Spinner.getInstance();

spinner.start('running step 1');
// Perform long running step 1
spinner.setText('running step 2');
// Perform long running step 2
spinner.stop();

API

Spinner.getInstance();

This will return a singleton instance for the Spinner class.

await spinner.start(text: string);

This will start a spinner with the given text.

await spinner.stop();

This will stop the spinner and clears the line.

spinner.setText(text: string);

Updates the text shown with the spinner.

spinner.setSpinnerType(type: string);
  • This is used to update the spinner type
  • The detault spinner type is dots2
  • To see list of all available spinner types please refer here
await spinner.succeed([text]: string);

Stop the spinner, change it to a green and persist the current text, or text if provided.

await spinner.fail([text]: string);

Stop the spinner, change it to a red and persist the current text, or text if provided.

await spinner.warn([text]: string)

Stop the spinner, change it to a yellow and persist the current text, or text if provided.

await spinner.info([text]: string)

Stop the spinner, change it to a blue and persist the current text, or text if provided.

await spinner.isRunning();

Returns true if the spinner is running.

License

MIT © Ameer Jhan

About

Awesome deno terminal spinners 🎨

Resources

License

Stars

Watchers

Forks

Packages

No packages published