From 5cdf013234f5fe3339e9e120d10d99ed3534fab0 Mon Sep 17 00:00:00 2001 From: sharkdp Date: Sat, 13 Jan 2018 20:53:55 +0100 Subject: [PATCH] Modify clap settings --- Cargo.toml | 1 - src/main.rs | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 0591a52..24e8754 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,5 +16,4 @@ indicatif = "0.8" [dependencies.clap] version = "2" default-features = false - features = ["suggestions", "color", "wrap_help"] diff --git a/src/main.rs b/src/main.rs index ea89cda..7254b16 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ extern crate ansi_term; +#[macro_use] extern crate clap; extern crate indicatif; @@ -67,8 +68,7 @@ fn run_benchmark(cmd: &str, options: &HyperfineOptions) { let mut results = vec![]; // Warmup phase - if let Some(warmup_count) = options.warmup_count - { + if let Some(warmup_count) = options.warmup_count { let bar = get_progress_bar(warmup_count, "Performing warmup runs"); for _ in 1..warmup_count { @@ -142,17 +142,17 @@ impl Default for HyperfineOptions { HyperfineOptions { warmup_count: None, min_runs: 10, - min_time_sec: 5.0 + min_time_sec: 5.0, } } } fn main() { let matches = App::new("hyperfine") - .global_settings(&[AppSettings::ColoredHelp]) - .version("0.1") + .version(crate_version!()) + .setting(AppSettings::ColoredHelp) + .setting(AppSettings::DeriveDisplayOrder) .about("A command-line benchmarking tool") - .author("David Peter ") .arg( Arg::with_name("command") .help("Command to benchmark") @@ -169,10 +169,9 @@ fn main() { ) .get_matches(); - let mut options = HyperfineOptions::default(); - options.warmup_count = - matches.value_of("warmup") + options.warmup_count = matches + .value_of("warmup") .and_then(|n| u64::from_str_radix(n, 10).ok()); let commands = matches.values_of("command").unwrap();