Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/michael-spengler/spinners
🦕. Terminal Spinners
https://github.com/michael-spengler/spinners
Last synced: 26 days ago
JSON representation
🦕. Terminal Spinners
- Host: GitHub
- URL: https://github.com/michael-spengler/spinners
- Owner: michael-spengler
- Created: 2020-09-12T10:43:41.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-10-02T16:10:27.000Z (about 1 year ago)
- Last Synced: 2024-05-09T18:59:47.319Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 13.7 KB
- Stars: 2
- Watchers: 3
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terminal Spinners
## Usage Examples
### Basic
```tsimport { TerminalSpinner } from "https://deno.land/x/spinners/mod.ts";
import { sleep } from "https://x.nest.land/[email protected]/mod.ts";const terminalSpinner = new TerminalSpinner("I will be back in about 3 seconds");
terminalSpinner.start();
await sleep(3) // or any other async action that'll take some time
terminalSpinner.succeed("Action completed");```
### Advanced
```tsimport { TerminalSpinner, SpinnerTypes } from "https://deno.land/x/spinners/mod.ts";
import { sleep } from "https://x.nest.land/[email protected]/mod.ts";const terminalSpinner = new TerminalSpinner({
text: "I will be back in about 3 seconds", // telling the user what is going on
color: "red", // see colors in util.ts
spinner: SpinnerTypes.arc, // check the SpinnerTypes - see import
indent: 0, // The level of indentation of the spinner in spaces
cursor: false, // Whether or not to display a cursor when the spinner is active
writer: Deno.stdout // anything using the Writer interface incl. stdout, stderr, and files
});terminalSpinner.start();
await sleep(3) // or any other async action that'll take some time
terminalSpinner.succeed("Action completed");```
## Further Options
You can also update the parameters while spinning etc. :)
Check the code for details - it should be self explaining.## Trigger Usage Examples
```sh
deno run https://deno.land/x/spinners/usage-example-basic.ts
``````sh
deno run https://deno.land/x/spinners/usage-example-advanced.ts
```## Trigger Test Execution
```sh
deno test https://deno.land/x/spinners/test.ts
```## Credits
Credits to https://deno.land/x/kia as a lot of its MIT code is just used in this module.