add clap deprecation notices

This commit is contained in:
Benjamin Rombaut authored and David Peter committed 2022-11-19 15:13:30 +01:00
1 parent 83e214e860
commit 5fcb7166a9
4 files changed
+44 -19

No files matched your search

+12 -12
View File
@@ -223,7 +223,7 @@ impl Options {
let mut options = Self::default();
let param_to_u64 = |param| {
matches
.value_of(param)
.get_one::<String>(param)
.map(|n| {
n.parse::<u64>()
.map_err(|e| OptionsError::IntParsingError(param, e))
@@ -260,17 +260,17 @@ impl Options {
(None, None) => {}
};
options.setup_command = matches.value_of("setup").map(String::from);
options.setup_command = matches.get_one::<String>("setup").map(String::from);
options.preparation_command = matches
.values_of("prepare")
.get_many::<String>("prepare")
.map(|values| values.map(String::from).collect::<Vec<String>>());
options.cleanup_command = matches.value_of("cleanup").map(String::from);
options.cleanup_command = matches.get_one::<String>("cleanup").map(String::from);
options.command_output_policy = if matches.is_present("show-output") {
options.command_output_policy = if matches.contains_id("show-output") {
CommandOutputPolicy::Inherit
} else if let Some(output) = matches.value_of("output") {
} else if let Some(output) = matches.get_one::<String>("output").map(|s| s.as_str()) {
match output {
"null" => CommandOutputPolicy::Null,
"pipe" => CommandOutputPolicy::Pipe,
@@ -287,7 +287,7 @@ impl Options {
CommandOutputPolicy::Null
};
options.output_style = match matches.value_of("style") {
options.output_style = match matches.get_one::<String>("style").map(|s| s.as_str()) {
Some("full") => OutputStyleOption::Full,
Some("basic") => OutputStyleOption::Basic,
Some("nocolor") => OutputStyleOption::NoColor,
@@ -322,10 +322,10 @@ impl Options {
OutputStyleOption::Disabled => {}
};
options.executor_kind = if matches.is_present("no-shell") {
options.executor_kind = if matches.contains_id("no-shell") {
ExecutorKind::Raw
} else {
match (matches.is_present("debug-mode"), matches.value_of("shell")) {
match (matches.contains_id("debug-mode"), matches.get_one::<String>("shell")) {
(false, Some(shell)) if shell == "default" => ExecutorKind::Shell(Shell::default()),
(false, Some(shell)) if shell == "none" => ExecutorKind::Raw,
(false, Some(shell)) => ExecutorKind::Shell(Shell::parse_from_str(shell)?),
@@ -335,17 +335,17 @@ impl Options {
}
};
if matches.is_present("ignore-failure") {
if matches.contains_id("ignore-failure") {
options.command_failure_action = CmdFailureAction::Ignore;
}
options.time_unit = match matches.value_of("time-unit") {
options.time_unit = match matches.get_one::<String>("time-unit").map(|s| s.as_str()) {
Some("millisecond") => Some(Unit::MilliSecond),
Some("second") => Some(Unit::Second),
_ => None,
};
if let Some(time) = matches.value_of("min-benchmarking-time") {
if let Some(time) = matches.get_one::<String>("min-benchmarking-time") {
options.min_benchmarking_time = time
.parse::<f64>()
.map_err(|e| OptionsError::FloatParsingError("min-benchmarking-time", e))?;