Skip to content

Commit

Permalink
Dev (#10)
Browse files Browse the repository at this point in the history
* added support for multiline animations
* multiline example added
* updated description and readme
* workflow name updates
  • Loading branch information
Arteiii authored Apr 5, 2024
1 parent 36ce596 commit cc792b4
Show file tree
Hide file tree
Showing 12 changed files with 310 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish_crate.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Cargo.toml Version and Publish to Crates
name: Publish to Crates

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_examples.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Compile Rust Examples and Upload to Release
name: Compile Rust

on:
push:
Expand Down
113 changes: 112 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@ readme = "README.md"
categories = ["command-line-utilities", "command-line-interface"]


description = "easy to use cli animation lib (Yet Another Spinner Lib ) 81+ predefined"
description = "Elevate your Rust command-line interfaces with 81+ spinner animations and multiline support (Yet Another Spinner Lib)"
repository = "https://github.com/Arteiii/zenity"
keywords = ["console", "animations", "cli", "spinner", "loading"]
homepage = "https://arteiii.github.io"


[dependencies]
crossterm = "0.27.0"
utils_arteii_rs = "0.1.0"
rand = "0.9.0-alpha.1"

[dev-dependencies]
unicode-icons = "1.0.1"
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# zenity (Yet Another Spinner Lib)

Elevate your Rust command-line interfaces with 81+ spinner animations and multiline support

[![Publish to Crates](https://github.com/Arteiii/zenity/actions/workflows/publish_crate.yml/badge.svg)](https://github.com/Arteiii/zenity/actions/workflows/publish_crate.yml)
[![Compile Rust and Upload to Release](https://github.com/Arteiii/zenity/actions/workflows/release_examples.yml/badge.svg)](https://github.com/Arteiii/zenity/actions/workflows/release_examples.yml)

[![CodeFactor](https://www.codefactor.io/repository/github/arteiii/zenity/badge)](https://www.codefactor.io/repository/github/arteiii/zenity)


![Crates.io Version](https://img.shields.io/crates/v/zenity)
![Crates.io License](https://img.shields.io/crates/l/zenity)
![docs.rs](https://img.shields.io/docsrs/zenity)

![preview gif](./images/WindowsTerminal_ZlTLEYK249.gif)
[![CodeFactor](https://www.codefactor.io/repository/github/arteiii/zenity/badge)](https://www.codefactor.io/repository/github/arteiii/zenity)

![multiline preview](./images/rustrover64_4bzlv2mWxK.gif)

![](./images/rustrover64_tlGiHM9JP0.gif)

easy to use cli animation lib based on crossterm

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?

Expand Down
53 changes: 53 additions & 0 deletions examples/multi_spinner.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
use std::thread::sleep;
use std::time::Duration;

use unicode_icons::symbols::{check_mark_button,cross_mark};

use zenity::multi_spinner::MultiSpinner;
use zenity::spinner::PreDefined;

fn main() {
let check_mark_text = check_mark_button();
let cross_mark_text = cross_mark();


let mut spinner = MultiSpinner::new();

// main thread operations
let spinner1 = spinner.add(PreDefined::dot_spinner11(false));
let spinner2 = spinner.add(PreDefined::binary(false));
let spinner3 = spinner.add(PreDefined::dot_spinner9(false));
let spinner4 = spinner.add(PreDefined::dot_spinner8(false));

// access the spinner through the Arc<Mutex<MultiSpinner>> reference
spinner.run_all();

sleep(Duration::from_secs(2));


sleep(Duration::from_secs(8));
spinner.set_text(&spinner2, "spinner2".to_string());
// stop spinner1
spinner.set_text(&spinner1, "spinner1".to_string());

sleep(Duration::from_secs(2));

spinner.stop(&spinner2);
spinner.set_text(&spinner2, format!("{} Successfully", &check_mark_text));


sleep(Duration::from_secs(2));
spinner.set_text(&spinner1, "spinner1 stopped".to_string());

spinner.stop(&spinner1);

sleep(Duration::from_secs(9));
spinner.stop(&spinner3);
spinner.stop(&spinner4);

spinner.set_text(&spinner3, format!("{} Failed!", &cross_mark_text));
spinner.set_text(&spinner4, format!("{} Failed!", &cross_mark_text));


sleep(Duration::from_secs(3000000));
}
Binary file removed images/WindowsTerminal_ZlTLEYK249.gif
Binary file not shown.
Binary file added images/rustrover64_4bzlv2mWxK.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/rustrover64_tlGiHM9JP0.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/animations/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
pub(crate) mod animation;
pub mod frames;

pub mod spinner;
Loading

0 comments on commit cc792b4

Please sign in to comment.