diff --git a/Cargo.lock b/Cargo.lock index 3b9cfca..9305395 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index d1c3b90..825ac2d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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"] diff --git a/src/common.rs b/src/common.rs index d95e97e..3991501 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,6 +1,7 @@ // stdlib types pub(crate) use std::{ borrow::Cow, + char, cmp::Reverse, collections::{BTreeMap, BTreeSet, HashMap}, convert::{Infallible, TryInto}, diff --git a/src/subcommand/torrent/create.rs b/src/subcommand/torrent/create.rs index ad22e12..9b2ecfd 100644 --- a/src/subcommand/torrent/create.rs +++ b/src/subcommand/torrent/create.rs @@ -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)]