add CLI option to identify a command with a custom name

CLI option `--name` can be used to define the name to identify a
command. If not passed, then the command itself is used. Commands
and names are paired in the same order: The first command executed gets
the first name passed as option.

Close #326
This commit is contained in:
Stéphane Campinas authored and David Peter committed 2020-10-15 22:42:44 +02:00
1 parent 674b5422ab
commit 0f0a109ca0
4 files changed
+27 -2

No files matched your search

+4
View File
@@ -127,6 +127,10 @@ fn build_hyperfine_options(matches: &ArgMatches<'_>) -> Result<HyperfineOptions,
(None, None) => {}
};
options.names = matches
.values_of("command-name")
.map(|values| values.map(String::from).collect::<Vec<String>>());
options.preparation_command = matches
.values_of("prepare")
.map(|values| values.map(String::from).collect::<Vec<String>>());