Deduplicate progress style string

type: reform
This commit is contained in:
Casey Rodarmor 2020-04-07 22:08:37 -07:00
parent db2a2ac4f5
commit a395052f7c
No known key found for this signature in database
GPG Key ID: 556186B153EC6FE0
3 changed files with 6 additions and 8 deletions

View File

@ -61,6 +61,10 @@ pub(crate) const TICK_CHARS: &str = concat!(
"⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿", // 0b1111---- "⢸⢹⢺⢻⢼⢽⢾⢿⣸⣹⣺⣻⣼⣽⣾⣿", // 0b1111----
); );
pub(crate) const PROGRESS_STYLE: &str = "{spinner:.green} ⟪{elapsed_precise}⟫ ⟦{bar:.cyan}⟧ \
{binary_bytes}/{binary_total_bytes} \
{binary_bytes_per_sec}, {eta}";
pub(crate) const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION")); pub(crate) const VERSION: &str = concat!("v", env!("CARGO_PKG_VERSION"));
pub(crate) const VERSION_MESSAGE: &str = "Print version number."; pub(crate) const VERSION_MESSAGE: &str = "Print version number.";

View File

@ -38,10 +38,7 @@ impl CreateContent {
.unwrap_or_else(|| PieceLengthPicker::from_content_size(files.total_size())); .unwrap_or_else(|| PieceLengthPicker::from_content_size(files.total_size()));
let style = ProgressStyle::default_bar() let style = ProgressStyle::default_bar()
.template( .template(consts::PROGRESS_STYLE)
"{spinner:.green} ⟪{elapsed_precise}⟫ ⟦{bar:40.cyan}⟧ \
{binary_bytes}/{binary_total_bytes} {binary_bytes_per_sec}, {eta}",
)
.tick_chars(consts::TICK_CHARS) .tick_chars(consts::TICK_CHARS)
.progress_chars(consts::PROGRESS_CHARS); .progress_chars(consts::PROGRESS_CHARS);

View File

@ -54,10 +54,7 @@ impl Verify {
let progress_bar = if env.err().is_styled_term() { let progress_bar = if env.err().is_styled_term() {
let style = ProgressStyle::default_bar() let style = ProgressStyle::default_bar()
.template( .template(consts::PROGRESS_STYLE)
"{spinner:.green} ⟪{elapsed_precise}⟫ ⟦{bar:40.cyan}⟧ \
{binary_bytes}/{binary_total_bytes} {binary_bytes_per_sec}, {eta}",
)
.tick_chars(consts::TICK_CHARS) .tick_chars(consts::TICK_CHARS)
.progress_chars(consts::PROGRESS_CHARS); .progress_chars(consts::PROGRESS_CHARS);