mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-11-03 01:21:25 +00:00
return an error if there are more name options than commands
This commit is contained in:
1 parent
71a47c0566
commit
25f8129212
2 files changed
+10
No files matched your search
@@ -130,6 +130,12 @@ fn build_hyperfine_options(matches: &ArgMatches<'_>) -> Result<HyperfineOptions,
|
||||
options.names = matches
|
||||
.values_of("command-name")
|
||||
.map(|values| values.map(String::from).collect::<Vec<String>>());
|
||||
if let Some(ref names) = options.names {
|
||||
let command_strings = matches.values_of("command").unwrap();
|
||||
if names.len() > command_strings.len() {
|
||||
return Err(OptionsError::TooManyCommandNames(command_strings.len()));
|
||||
}
|
||||
}
|
||||
|
||||
options.preparation_command = matches
|
||||
.values_of("prepare")
|
||||
|
||||
Reference in new issue
Block a user