diff --git a/Cargo.toml b/Cargo.toml index 43d0eb0..cfa681a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "termprogress" description = "A terminal progress bar renderer with status and spinners" license = "GPL-3.0-or-later" -version = "0.2.3" +version = "0.b2.4" authors = ["Avril "] edition = "2018" diff --git a/README.md b/README.md index 14345f4..14219dc 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,9 @@ Without this, `Bar` will not attempt to get the terminal's size to prevent overf ## Traits The library comes with traits for progress bars: [`ProgressBar`][progress-bar], and [`Spinner`][spinner]. -The default implementations for these are `Bar` and `Spin`, but you can provide your own implementations too for more customisability +The default implementations for these are `Bar` and `Spin`, but you can provide your own implementations too for more customisability. + +There is also `Silent`, which implements both `ProgressBar` and `Spinner`, and does nothing, to allow for easily turning off or on progress displays depending on config. [progress-bar]: ./src/inter.rs [spinner]: ./src/inter.rs @@ -90,8 +92,14 @@ pub fn does_work(bar: &mut P) does_work(&mut Bar::default()); does_work(&mut MyBar::new()); + +if NOPROGRESS { + does_wotk(&mut Silent) +} else { + does_work(&mut Bar::default()) +} ``` -## License +# License GPL'd with love <3 diff --git a/src/inter.rs b/src/inter.rs index 23d88f6..895df7b 100644 --- a/src/inter.rs +++ b/src/inter.rs @@ -44,7 +44,7 @@ pub trait Spinner: Display } /// A trait for creating a progress bar or spinner with a title. -pub trait WithTitle: Sized + ProgressBar + Display +pub trait WithTitle: Sized + Display { fn with_title(len: usize, string: impl AsRef) -> Self; fn update(&mut self);