2022-07-15 12:59:22 -05:00
|
|
|
# spinoff
|
|
|
|
`spinoff` is a simple to use library for displaying spinners in the terminal, with plenty of features and options.
|
|
|
|
|
2022-07-15 14:34:36 -05:00
|
|
|
[![Version](https://img.shields.io/crates/v/spinoff.svg)](https://crates.io/crates/spinoff) [![Downloads](https://img.shields.io/crates/d/spinoff)](https://crates.io/crates/spinoff) [![Docs](https://img.shields.io/docsrs/spinoff)](https://docs.rs/spinoff/latest/spinoff/)
|
2022-07-15 12:59:22 -05:00
|
|
|
|
2022-07-16 10:06:11 -05:00
|
|
|
|
|
|
|
<p>
|
|
|
|
<br>
|
2022-07-18 03:48:56 -05:00
|
|
|
<img width="800" src="assets/index.gif">
|
2022-07-16 10:06:11 -05:00
|
|
|
<br>
|
|
|
|
<br>
|
|
|
|
</p>
|
2022-07-16 08:58:14 -05:00
|
|
|
|
2022-07-15 12:59:22 -05:00
|
|
|
## Usage
|
|
|
|
|
|
|
|
```rust
|
2022-07-17 07:24:43 -05:00
|
|
|
use spinoff::{Spinner, Spinners};
|
2022-07-15 12:59:22 -05:00
|
|
|
use std::thread::sleep;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
2022-07-17 07:28:00 -05:00
|
|
|
let spinner = Spinner::new(Spinners::Dots, "Loading...", Some(Color::Blue));
|
2022-07-15 12:59:22 -05:00
|
|
|
sleep(Duration::from_secs(3));
|
|
|
|
spinner.success("Done!");
|
|
|
|
```
|
|
|
|
|
2022-07-16 05:38:43 -05:00
|
|
|
### Update a spinner
|
|
|
|
|
|
|
|
```rust
|
2022-07-17 07:24:43 -05:00
|
|
|
use spinoff::{Spinner, Spinners};
|
2022-07-16 05:38:43 -05:00
|
|
|
use std::thread::sleep;
|
|
|
|
use std::time::Duration;
|
|
|
|
|
2022-07-17 07:28:00 -05:00
|
|
|
let mut spinner = Spinner::new(Spinners::Dots, "Loading...", Some(Color::Blue));
|
2022-07-16 05:38:43 -05:00
|
|
|
sleep(Duration::from_secs(3));
|
2022-07-17 07:24:43 -05:00
|
|
|
spinner.update(Spinners::Dots2, "Loading...", None);
|
2022-07-16 05:38:43 -05:00
|
|
|
sleep(Duration::from_secs(3));
|
2022-07-16 06:09:22 -05:00
|
|
|
spinner.stop_and_persist("👨💻", "Done!");
|
2022-07-16 05:38:43 -05:00
|
|
|
```
|
|
|
|
|
|
|
|
|
2022-07-15 12:59:22 -05:00
|
|
|
## Documentation
|
|
|
|
|
|
|
|
* All documentation can be found on the [Docs.rs page](https://docs.rs/spinoff/latest/spinoff/).
|
|
|
|
* If you want to see all the available `Spinner` options, check the [`Spinners`](src/utils/spinner_enum.rs) enum.
|
|
|
|
|
|
|
|
## Examples
|
|
|
|
|
|
|
|
To run some of the included examples, use:
|
|
|
|
```bash
|
|
|
|
cargo run --example all_spinners
|
|
|
|
```
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cargo run --example simple
|
|
|
|
```
|
|
|
|
|
|
|
|
## Contributing
|
|
|
|
|
|
|
|
Any contributions to this crate are highly appreciated. If you have any ideas/suggestions/bug fixes, please open an issue or pull request.
|
|
|
|
|
|
|
|
## License
|
|
|
|
|
2022-07-16 10:06:11 -05:00
|
|
|
This crate is licensed under the [MIT license](LICENSE).
|