Skip to content
Myr

Specify clap::ValueHint for arguments

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Albert Safin · committed by David Peter · parent deaec15 · Browse files · 1 file+11 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−0 removed

  • other:+11 added−0 removed

1 file+11 added−0 removed

modified:src/cli.rs+11 added
1use std::ffi::OsString;23use clap::{4 builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,5 ValueHint,6};78pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches9where
21 unmodified lines
31 '--shell=none'. If multiple commands are given, hyperfine will show a \32 comparison of the respective runtimes.")33 .required(true)34 .action(ArgAction::Append)35 .value_hint(ValueHint::CommandString)36 .value_parser(NonEmptyStringValueParser::new()),37 )38 .arg(39 Arg::new("warmup")
37 unmodified lines
77 .long("setup")78 .short('s')79 .action(ArgAction::Set)80 .value_name("CMD")81 .value_hint(ValueHint::CommandString)82 .help(83 "Execute CMD before each set of timing runs. This is useful for \84 compiling your software with the provided parameters, or to do any \85 other work that should happen once before a series of benchmark runs, \
6 unmodified lines
92 .short('p')93 .action(ArgAction::Append)94 .num_args(1)95 .value_name("CMD")96 .value_hint(ValueHint::CommandString)97 .help(98 "Execute CMD before each timing run. This is useful for \99 clearing disk caches, for example.\nThe --prepare option can \100 be specified once for all commands or multiple times, once for \
6 unmodified lines
107 .long("cleanup")108 .short('c')109 .action(ArgAction::Set)110 .value_name("CMD")111 .value_hint(ValueHint::CommandString)112 .help(113 "Execute CMD after the completion of all benchmarking \114 runs for each individual command to be benchmarked. \115 This is useful if the commands to be benchmarked produce \
55 unmodified lines
171 .short('S')172 .action(ArgAction::Set)173 .value_name("SHELL")174 .overrides_with("shell")175 .value_hint(ValueHint::CommandString)176 .help("Set the shell to use for executing benchmarked commands. This can be the \177 name or the path to the shell executable, or a full command line \178 like \"bash --norc\". It can also be set to \"default\" to explicitly select \179 the default shell on this platform. Finally, this can also be set to \
62 unmodified lines
242 Arg::new("export-asciidoc")243 .long("export-asciidoc")244 .action(ArgAction::Set)245 .value_name("FILE")246 .value_hint(ValueHint::FilePath)247 .help("Export the timing summary statistics as an AsciiDoc table to the given FILE. \248 The output time unit can be changed using the --time-unit option."),249 )250 .arg(251 Arg::new("export-csv")252 .long("export-csv")253 .action(ArgAction::Set)254 .value_name("FILE")255 .value_hint(ValueHint::FilePath)256 .help("Export the timing summary statistics as CSV to the given FILE. If you need \257 the timing results for each individual run, use the JSON export format. \258 The output time unit is always seconds."),259 )
1 unmodified line
261 Arg::new("export-json")262 .long("export-json")263 .action(ArgAction::Set)264 .value_name("FILE")265 .value_hint(ValueHint::FilePath)266 .help("Export the timing summary statistics and timings of individual runs as JSON to the given FILE. \267 The output time unit is always seconds"),268 )269 .arg(270 Arg::new("export-markdown")271 .long("export-markdown")272 .action(ArgAction::Set)273 .value_name("FILE")274 .value_hint(ValueHint::FilePath)275 .help("Export the timing summary statistics as a Markdown table to the given FILE. \276 The output time unit can be changed using the --time-unit option."),277 )278 .arg(279 Arg::new("export-orgmode")280 .long("export-orgmode")281 .action(ArgAction::Set)282 .value_name("FILE")283 .value_hint(ValueHint::FilePath)284 .help("Export the timing summary statistics as an Emacs org-mode table to the given FILE. \285 The output time unit can be changed using the --time-unit option."),286 )287 .arg(
82 unmodified lines