diff --git a/Cargo.toml b/Cargo.toml index ba3518e..e4eca8b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ space = "0.17.0" lz4_flex = { version = "0.11.3", default-features = false, features = ["frame"] } ticky = { version = "1.0.2", optional = true } pretty-duration = { version = "0.1.1", optional = true } -indicatif = { version = "0.17.8", optional = true } +indicatif = { version = "0.17.8", optional = true, features = ["rayon", "improved_unicode"] } distances = "1.6.3" candle-examples = "0.4.1" candle-core = "0.4.1" diff --git a/src/main.rs b/src/main.rs index be54b8c..291b9a3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,6 @@ use clap::{command, Parser, Subcommand}; use fastembed::TextEmbedding; +use indicatif::ProgressStyle; use indicatif::{ProgressBar, ProgressDrawTarget}; use pretty_duration::pretty_duration; use rodio::{Decoder, OutputStream, Sink}; @@ -138,8 +139,9 @@ fn main() -> Result<(), Box> { let progress_bar = ProgressBar::with_draw_target( Some(num_texts.try_into()?), ProgressDrawTarget::hidden(), - ) - .with_message(format!("Inserting texts from {} file(s).", num_texts)); + ); + // .with_message(format!("Inserting texts from {} file(s).", num_texts)); + progress_bar.set_style(progress_bar_style()?); let mut i = 0; let mut texts = Vec::new(); // Insert texts in batches of INSERT_BATCH_SIZE. @@ -228,8 +230,9 @@ fn main() -> Result<(), Box> { let progress_bar = ProgressBar::with_draw_target( Some(num_images.try_into()?), ProgressDrawTarget::hidden(), - ) - .with_message(format!("Inserting images from {} file(s).", num_images)); + ); + // .with_message(format!("Inserting images from {} file(s).", num_images)); + progress_bar.set_style(progress_bar_style()?); let images: Vec = file_paths .into_iter() .map(|x| x.to_str().unwrap().to_string()) @@ -316,8 +319,9 @@ fn main() -> Result<(), Box> { let progress_bar = ProgressBar::with_draw_target( Some(num_sounds.try_into()?), ProgressDrawTarget::hidden(), - ) - .with_message(format!("Inserting sounds from {} file(s).", num_sounds)); + ); + // .with_message(format!("Inserting sounds from {} file(s).", num_sounds)); + progress_bar.set_style(progress_bar_style()?); let sounds: Vec = file_paths .into_iter() .map(|x| x.to_str().unwrap().to_string()) @@ -391,3 +395,7 @@ fn main() -> Result<(), Box> { } Ok(()) } + +fn progress_bar_style() -> Result> { + Ok(ProgressStyle::with_template("[{elapsed} elapsed, {eta} remaining ({duration} total)] {wide_bar:.cyan/blue} {human_pos} of {human_len} ({percent}%) {msg}")?) +}