Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/61130061/dora
Dora is funny terminal spinner for deno.
https://github.com/61130061/dora
cli-app cli-tools deno deno-module denoland typescript
Last synced: 26 days ago
JSON representation
Dora is funny terminal spinner for deno.
- Host: GitHub
- URL: https://github.com/61130061/dora
- Owner: 61130061
- License: mit
- Created: 2022-08-26T10:49:59.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-08-30T07:33:43.000Z (over 2 years ago)
- Last Synced: 2024-12-05T18:48:12.003Z (about 1 month ago)
- Topics: cli-app, cli-tools, deno, deno-module, denoland, typescript
- Language: TypeScript
- Homepage: https://deno.land/x/dora
- Size: 81.1 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Dora π¦
> **WARNING**: This module is unstable since getting console columns in deno is quite difficult rn [Read](https://doc.deno.land/deno/unstable/~/Deno.consoleSize).
There might be some bug when you change the size of terminal while running.
If anyone have a way, feel free to contribute.Imigrate to [deno](https://deno.land)π¦?
Don't worry, Dora is funny terminal spinner for deno.
Dora does not use any NPM package to make sure that your project is still light.## Feature
- [x] Show/Hide cursor option [Read](#doraoptionstext)
- [x] Support multiple lines `βΌοΈBetaβΌοΈ` with manually input the console columns
- [x] Customable final icon π¦ π¦ πΌ [Read](#instance)
- [x] Customable spinner [Read](#spinner-write-only)coming soon feature...
- [ ] Indent your text
- [ ] Promise function
- [ ] Multiple ready to use spinner options
- [ ] Available for unsupport unicode user## Install
```bash
echo "Sorry, dont have to install anything"
```## Usage
```ts
import dora from 'https://deno.land/x/[email protected]/mod.ts';const Dora = dora();
Dora.start('Loading Dora...');
setTimeout(() => {
Dora.succeed('Dora is ready');
}, 1000);```
## API
### dora(options|text)
#### text `string`
#### options `object`
| Name | Type | Default | Description |
|------------|:---------:|:-------:|------------------------------------------------------------------------------------------------------------------------------|
| text | `string` | null | Message shown during loading. You can leave it be and input it later when you use start(). |
| color | `string` | cyan | Color of the spinner. (available color: `cyan`, `black`, `red`, `green`, `yellow`, `blue`, `magenta`, `white`) |
| showCursor | `boolean` | false | Show/Hide cursor during load is running. |
| width | `int` | 80 | Width (columns) of your console. This option will impact your spinner when there are multiple lines of text in one spinner. |### Instance
#### .start(text `string`)
Start the spinner and set text to `text` if provided.
#### .succeed(text `string`|options `object`)
| Name | Type | Default | Description |
|------|:--------:|:-------:|--------------------------------------------------------------------------------------------------------|
| text | `string` | null | New text that will be shown when the spinner is stopped. (If not provided, it will show loading text.) |
| icon | `string` | `β` | New symbol when the spinner is stopped. |Stop the spinner, clear spinner annd change it to `β` symbol with new `text` if provided.
#### .fail(text `string`|options `object`)
| Name | Type | Default | Description |
|------|:--------:|:-------:|--------------------------------------------------------------------------------------------------------|
| text | `string` | null | New text that will be shown when the spinner is stopped. (If not provided, it will show loading text.) |
| icon | `string` | `β` | New symbol when the spinner is stopped. |Stop the spinner, clear spinner annd change it to `β` symbol with new `text` if provided.
#### .warn(text `string`|options `object`)
| Name | Type | Default | Description |
|------|:--------:|:-------:|--------------------------------------------------------------------------------------------------------|
| text | `string` | null | New text that will be shown when the spinner is stopped. (If not provided, it will show loading text.) |
| icon | `string` | `β ` | New symbol when the spinner is stopped. |Stop the spinner, clear spinner annd change it to `β ` symbol with new `text` if provided.
#### .info(text `string`|options `object`)
| Name | Type | Default | Description |
|------|:--------:|:-------:|--------------------------------------------------------------------------------------------------------|
| text | `string` | null | New text that will be shown when the spinner is stopped. (If not provided, it will show loading text.) |
| icon | `string` | `βΉ` | New symbol when the spinner is stopped. |Stop the spinner, clear spinner annd change it to `βΉ` symbol with new `text` if provided.
#### .text `read/write`
Type: `string`
Read and write text of the dora.
#### .color `read/write`
Type: `string`
Read and write color of spinner [check available color](#doraoptionstext).
#### .spinner `write only`
Type: `Array` of `string`
Change the spinner of the dora.
> **NOTE**: Don't have one? Find some [here](https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json).```ts
dora.text = 'Trying new spinner...';
dora.color = 'blue';
dora.spinner = [
"[ ]",
"[= ]",
"[== ]",
"[=== ]",
"[ ===]",
"[ ==]",
"[ =]",
"[ ]",
"[ =]",
"[ ==]",
"[ ===]",
"[====]",
"[=== ]",
"[== ]",
"[= ]"
]dora.start();
```## Related
- [ora](https://github.com/sindresorhus/ora) Elegant terminal spinner