#user-input #animation #input-validation #spinner #console #loading

zenity

100+ spinner animations and Progress Bars and Support for Multiple Animations at Once

27 stable releases

3.6.1 Jun 28, 2024
3.6.0 Jun 8, 2024
3.5.0 May 1, 2024
3.4.1 Apr 24, 2024
1.4.0 Apr 9, 2024

#185 in Command-line interface

Download history 162/week @ 2024-07-28 7/week @ 2024-09-15 12/week @ 2024-09-22 10/week @ 2024-09-29 1/week @ 2024-10-06

2,764 downloads per month

Custom license

165KB
2.5K SLoC

Zenity svg logo

Yet Another Spinner Lib

Upgrade your Rust CLIs with 100+ spinner animations, progress bars, and multiline support, plus user input validation, logging, and automatic requirement checks

Publish to Crates Compile Rust Crates.io Version docs.rs
CodeFactor codecov badge

Table of Contents

Overview

Do you often find yourself gazing into the void of your terminal,
wondering if your computer has decided to take a coffee break without notifying you?

100+ predefined animations

How to Use?

It's as easy as pie (or maybe even easier, depending on your pie-making skills)!
Follow these steps:

cargo add zenity
// example/basic.rs

use std::thread::sleep;
use std::time::Duration;
use zenity::spinner::MultiSpinner;

fn main() {
    // create a LoadingAnimation instance using one of the predefined animations
    let spinner = MultiSpinner::default();
    sleep(Duration::from_secs(5));

    // optional:
    // set the text to "Loading..."
    spinner.set_text(&spinner.get_last(), "  Loading...".to_string());

    sleep(Duration::from_secs(500));
    // `loading_animation` will run out of scope now and get dropped,
    // thus the animation will stop and remove itself from the console
}

check out the examples for more

[!NOTE] the lib already includes checks for --color following the conventions by: Rain's Rust CLI recommendations

Documentation

Documentation You can access the general documentation for the latest crate online at docs.rs.
For more detailed information, navigate to the modules section.

Alternatively, you can view the documentation locally by running the following command:

cargo doc --open -p zenity

The styles provided are reexports of crossterm, which you can find here.

Examples

For a list of examples you can run, execute the following command:

cargo run --example

Contributing

Contributions, bug reports, feature requests, and suggestions are all welcome!

If you encounter any issues or have ideas for improvements, please don't hesitate to open an issue on GitHub.
Pull requests are also highly appreciated.
If you find this project helpful or enjoyable, consider giving it a star on GitHub.

Thank you for your interest and contributions!

Preview

progress bar

menu input preview

multiline preview

Disclaimer

Now, we won't promise you that cli_loading_magic will solve all your problems.
We can't guarantee it won't crash your terminal or cause your computer to sprout legs and walk away in protest.

But hey, life's an adventure, right?

Embrace the chaos, enjoy the ride, and remember:
if all else fails, there's always Ctrl+C.

Credits

This project wouldn't have been possible without the amazing work of the following projects:

License

This project is licensed under the DWFYW License.

For more information, see the LICENSE file.

Dependencies

~4–10MB
~93K SLoC