Improve spinner and progress bar
- Switch to my branch of indicatif on github - Use binary braille spinner - Use fine-grained progress bar - Improve template formatting - Use SI units for bytes/s type: changed
This commit is contained in:
parent
b25b389ae6
commit
4371bb1402
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -340,8 +340,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "indicatif"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "49a68371cf417889c9d7f98235b7102ea7c54fc59bcbd22f3dea785be9d27e40"
|
||||
source = "git+https://github.com/casey/indicatif.git?branch=binary-bytes-per-sec#a22e3bdce304d195890774688a1660427c59f2fd"
|
||||
dependencies = [
|
||||
"console",
|
||||
"lazy_static",
|
||||
|
|
|
@ -18,7 +18,6 @@ atty = "0.2.0"
|
|||
chrono = "0.4.1"
|
||||
console = "0.10.0"
|
||||
globset = "0.4.0"
|
||||
indicatif = "0.14.0"
|
||||
libc = "0.2.0"
|
||||
md5 = "0.7.0"
|
||||
pretty_assertions = "0.6.0"
|
||||
|
@ -43,6 +42,11 @@ git = "https://github.com/casey/bendy.git"
|
|||
branch = "serde"
|
||||
features = ["serde"]
|
||||
|
||||
[dependencies.indicatif]
|
||||
version = "0.14.0"
|
||||
git = "https://github.com/casey/indicatif.git"
|
||||
branch = "binary-bytes-per-sec"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.103"
|
||||
features = ["derive"]
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// stdlib types
|
||||
pub(crate) use std::{
|
||||
borrow::Cow,
|
||||
char,
|
||||
cmp::Reverse,
|
||||
collections::{BTreeMap, BTreeSet, HashMap},
|
||||
convert::{Infallible, TryInto},
|
||||
|
|
|
@ -205,7 +205,9 @@ impl Create {
|
|||
|
||||
errln!(env, "[1/3] \u{1F9FF} Searching for files…");
|
||||
|
||||
let style = ProgressStyle::default_spinner().template("{spinner:.green} {msg:.bold}…");
|
||||
let style = ProgressStyle::default_spinner()
|
||||
.template("{spinner:.green} {msg:.bold}…")
|
||||
.tick_chars(&Self::tick_chars());
|
||||
|
||||
let spinner = ProgressBar::new_spinner().with_style(style);
|
||||
|
||||
|
@ -285,10 +287,11 @@ impl Create {
|
|||
|
||||
let style = ProgressStyle::default_bar()
|
||||
.template(
|
||||
"{spinner:.green} [{elapsed_precise}] \u{2588}{bar:40.cyan/blue}\u{2588} \
|
||||
{bytes}/{total_bytes} ({bytes_per_sec}, {eta})",
|
||||
"{spinner:.green} ⟪{elapsed_precise}⟫ ⟦{bar:40.cyan}⟧ {binary_bytes}/{binary_total_bytes} \
|
||||
⟨{binary_bytes_per_sec}, {eta}⟩",
|
||||
)
|
||||
.progress_chars("\u{2593}\u{2592}\u{2591}");
|
||||
.tick_chars(&Self::tick_chars())
|
||||
.progress_chars("█▉▊▋▌▍▎▏ ");
|
||||
|
||||
let progress_bar = ProgressBar::new(files.total_size().count()).with_style(style);
|
||||
|
||||
|
@ -376,6 +379,27 @@ impl Create {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn tick_chars() -> &'static str {
|
||||
"\
|
||||
⠀⠁⠂⠃⠄⠅⠆⠇⡀⡁⡂⡃⡄⡅⡆⡇\
|
||||
⠈⠉⠊⠋⠌⠍⠎⠏⡈⡉⡊⡋⡌⡍⡎⡏\
|
||||
⠐⠑⠒⠓⠔⠕⠖⠗⡐⡑⡒⡓⡔⡕⡖⡗\
|
||||
⠘⠙⠚⠛⠜⠝⠞⠟⡘⡙⡚⡛⡜⡝⡞⡟\
|
||||
⠠⠡⠢⠣⠤⠥⠦⠧⡠⡡⡢⡣⡤⡥⡦⡧\
|
||||
⠨⠩⠪⠫⠬⠭⠮⠯⡨⡩⡪⡫⡬⡭⡮⡯\
|
||||
⠰⠱⠲⠳⠴⠵⠶⠷⡰⡱⡲⡳⡴⡵⡶⡷\
|
||||
⠸⠹⠺⠻⠼⠽⠾⠿⡸⡹⡺⡻⡼⡽⡾⡿\
|
||||
⢀⢁⢂⢃⢄⢅⢆⢇⣀⣁⣂⣃⣄⣅⣆⣇\
|
||||
⢈⢉⢊⢋⢌⢍⢎⢏⣈⣉⣊⣋⣌⣍⣎⣏\
|
||||
⢐⢑⢒⢓⢔⢕⢖⢗⣐⣑⣒⣓⣔⣕⣖⣗\
|
||||
⢘⢙⢚⢛⢜⢝⢞⢟⣘⣙⣚⣛⣜⣝⣞⣟\
|
||||
⢠⢡⢢⢣⢤⢥⢦⢧⣠⣡⣢⣣⣤⣥⣦⣧\
|
||||
⢨⢩⢪⢫⢬⢭⢮⢯⣨⣩⣪⣫⣬⣭⣮⣯\
|
||||
⢰⢱⢲⢳⢴⢵⢶⢷⣰⣱⣲⣳⣴⣵⣶⣷\
|
||||
⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿\
|
||||
"
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
Loading…
Reference in New Issue
Block a user