Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ameerthehacker/deno-cli-spinners
Awesome deno terminal spinners :art:
https://github.com/ameerthehacker/deno-cli-spinners
Last synced: about 1 month ago
JSON representation
Awesome deno terminal spinners :art:
- Host: GitHub
- URL: https://github.com/ameerthehacker/deno-cli-spinners
- Owner: ameerthehacker
- License: mit
- Created: 2019-02-03T12:19:15.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2021-10-20T15:43:53.000Z (about 3 years ago)
- Last Synced: 2024-05-23T10:11:17.454Z (7 months ago)
- Language: TypeScript
- Size: 10.7 KB
- Stars: 58
- Watchers: 3
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-deno - cli-spinner - 在执行长任务时在终端中显示加载中。 (Uncategorized / Uncategorized)
README
# CLI Spinners for Deno
> Awesome deno terminal spinners
![example screenshot](https://i.imgur.com/RBsL1k9.gif)
> This package is inspired from [ora](https://github.com/sindresorhus/ora) and [cli-spinners](https://github.com/sindresorhus/cli-spinners)
## Usage
```typescript
import Spinner from 'https://deno.land/x/[email protected]/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
```typescript
Spinner.getInstance();
```This will return a singleton instance for the `Spinner` class.
```typescript
await spinner.start(text: string);
```This will start a spinner with the given text.
```typescript
await spinner.stop();
```This will stop the spinner and clears the line.
```typescript
spinner.setText(text: string);
```Updates the `text` shown with the spinner.
```typescript
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](https://github.com/ameerthehacker/deno-cli-spinner/blob/master/spinners.ts)```typescript
await spinner.succeed([text]: string);
```Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided.
```typescript
await spinner.fail([text]: string);
```Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided.
```typescript
await spinner.warn([text]: string)
```Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided.
```typescript
await spinner.info([text]: string)
```Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided.
```typescript
await spinner.isRunning();
```Returns true if the spinner is running.
## License
MIT © [Ameer Jhan](mailto:[email protected])