diff --git a/src/hpk.rs b/src/hpk.rs index 8f82518..b34e3cc 100644 --- a/src/hpk.rs +++ b/src/hpk.rs @@ -17,6 +17,8 @@ use { }, }; +static TEMPLATE: &str = "[ {prefix} ] {wide_bar}{pos:>5.cyan}/{len:5.green}{msg:>30}"; + fn main() -> Result<(), Box> { let matches = cli().get_matches(); match matches.subcommand() { @@ -70,10 +72,7 @@ fn create(matches: &ArgMatches) -> Result<(), Box> { let (sender, receiver) = mpsc::channel(); let len = creator.len(); let pb = ProgressBar::new(len as u64); - pb.set_style( - ProgressStyle::with_template("[ {prefix} ] {wide_bar}{pos:>5.cyan}/{len:5.green}{msg:>30}") - .unwrap(), - ); + pb.set_style(ProgressStyle::with_template(TEMPLATE).unwrap()); pb.set_prefix("Adding files"); pb.println(format!( "Creating package {}-{}_{}.tar.zst", @@ -85,7 +84,7 @@ fn create(matches: &ArgMatches) -> Result<(), Box> { Message::MemberAdded(s) => { pb.set_message(s.split('/').last().unwrap().to_string()); pb.inc(1); - }, + } Message::Success(_s) => { pb.inc(1); pb.finish_and_clear(); @@ -103,7 +102,7 @@ fn create(matches: &ArgMatches) -> Result<(), Box> { Ok(_) => { println!("Package created successfully"); Ok(()) - }, + } Err(e) => Err(io::Error::new(ErrorKind::Other, format!("{e:?}")).into()), } } diff --git a/src/lib.rs b/src/lib.rs index 74276c0..ba9a601 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,6 +24,7 @@ fn create() -> Command { .args([ Arg::new("directory") .help("the directory where the files are located") + .value_hint(ValueHint::DirPath) .required(true) .num_args(1), Arg::new("output") @@ -37,6 +38,7 @@ fn create() -> Command { .help("path to the package specs file in `ron` format") .short('s') .long("specs") + .value_hint(ValueHint::FilePath) .conflicts_with_all(["name", "package-version", "release", "dependencies"]) .num_args(1), Arg::new("name")