Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaywcjlove/loading-cli
Terminal loading effect.
https://github.com/jaywcjlove/loading-cli
cli loader loading loading-cli nodejs spinner terminal
Last synced: 27 days ago
JSON representation
Terminal loading effect.
- Host: GitHub
- URL: https://github.com/jaywcjlove/loading-cli
- Owner: jaywcjlove
- Created: 2016-05-26T19:07:24.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-01-04T12:43:12.000Z (11 months ago)
- Last Synced: 2024-10-29T11:58:21.321Z (about 1 month ago)
- Topics: cli, loader, loading, loading-cli, nodejs, spinner, terminal
- Language: JavaScript
- Homepage: https://jaywcjlove.github.io/loading-cli
- Size: 90.8 KB
- Stars: 54
- Watchers: 4
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
- awesome-github-star - loading-cli
README
# loading-cli
[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/loading-cli)
[![CI](https://github.com/jaywcjlove/loading-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/loading-cli/actions/workflows/ci.yml)Terminal loading effect.
# Install
```bash
$ npm install --save loading-cli
```# Usage
```js
const loading = require('loading-cli');
const load = loading("loading text!!").start()setTimeout(function(){
load.color = 'yellow';
load.text = ' Loading rainbows';
},2000)// stop
setTimeout(function(){
load.stop()
},3000)
```Custom text color [colors-cli](https://github.com/jaywcjlove/colors-cli)
```js
const color = require('colors-cli/toxic');
const loading = require('loading-cli');const load = loading("loading text!!".blue).start();
// stop
setTimeout(function(){
load.stop()
},3000)
```# API
## loading([options|text])
### options
```js
load({
"text":"loading text!!",
"color":"yellow",
"interval":100,
"stream": process.stdout,
"frames":["◰", "◳", "◲", "◱"]
})
```### text
Type: string
Text to display after the spinner.```js
loading("loading text!!")
```## color
Values:`black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`
## frames
```bash
["◰", "◳", "◲", "◱"]
["◐", "◓", "◑", "◒"]
[".", "o", "O", "°", "O", "o", "."]
["⊶", "⊷"]
["ဝ", "၀"]
["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"]
["🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 "]
```# Instance
## .start([text])
Start the spinner. Returns the instance.
## .stop()
Stop and clear the spinner. Returns the instance.
## .clear()
Clear the spinner. Returns the instance.
## .succeed([text])
Stop the spinner, change it to a green `✔` and persist the current text, or text if provided. Returns the instance. See the GIF below.
## .fail([text])
Stop the spinner, change it to a red `✖` and persist the current text, or text if provided. Returns the instance. See the GIF below.
## .warn([text])
Stop the spinner, change it to a yellow `⚠` and persist the current text, or text if provided. Returns the instance.
## .info([text])
Stop the spinner, change it to a blue `ℹ` and persist the current text, or text if provided. Returns the instance.
## .render()
Manually render a new frame. Returns the instance.
## .frame()
Get a new frame.
```js
const loading = require('loading-cli');
const load = loading("loading text!!");
load.frame(["◰", "◳", "◲", "◱"]);
load.start();
```## .text
Change the text.
## .color
Change the spinner color.
## Contributors
As always, thanks to our amazing contributors!
Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).
## License
Licensed under the MIT License.