Skip to content
Myr

chore: run fmt

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

authored by Benjamin Rombaut · committed by David Peter · parent 17aca87 · Browse files · 3 files+25 added−8 removed
This commit

State

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

Diff stats

3 files+25 added−8 removed

  • other:+25 added−8 removed

3 files+25 added−8 removed

modified:src/cli.rs+3 added-1 removed
1use std::ffi::OsString;23use clap::{crate_version, Arg, ArgMatches, Command, builder::NonEmptyStringValueParser, ArgAction};3use clap::{4 builder::NonEmptyStringValueParser, crate_version, Arg, ArgAction, ArgMatches, Command,5};67pub fn get_cli_arguments<'a, I, T>(args: I) -> ArgMatches8where9 I: IntoIterator<Item = T>,
311 unmodified lines
modified:src/command.rs+18 added-6 removed
8 unmodified lines
9 ParameterNameAndValue,10 },11};1213use clap::{ArgMatches, parser::ValuesRef};13use clap::{parser::ValuesRef, ArgMatches};1415use crate::parameter::tokenize::tokenize;16use crate::parameter::ParameterValue;17
99 unmodified lines
117118impl<'a> Commands<'a> {119 pub fn from_cli_arguments(matches: &'a ArgMatches) -> Result<Commands> {120 let command_names = matches.get_many::<String>("command-name");121 let command_strings = matches.get_many::<String>("command").unwrap_or_default().map(|v| v.as_str()).collect::<Vec<_>>();121 let command_strings = matches122 .get_many::<String>("command")123 .unwrap_or_default()124 .map(|v| v.as_str())125 .collect::<Vec<_>>();126127 if let Some(args) = matches.get_many::<String>("parameter-scan") {124 let step_size = matches.get_one::<String>("parameter-step-size").map(|s| s.as_str());128 let step_size = matches129 .get_one::<String>("parameter-step-size")130 .map(|s| s.as_str());131 Ok(Self(Self::get_parameter_scan_commands(132 command_names,133 command_strings,134 args,135 step_size,136 )?))137 } else if let Some(args) = matches.get_many::<String>("parameter-list") {132 let command_names = command_names.map_or(vec![], |names| names.map(|v| v.as_str()).collect::<Vec<_>>());138 let command_names = command_names.map_or(vec![], |names| {139 names.map(|v| v.as_str()).collect::<Vec<_>>()140 });141 let args: Vec<_> = args.map(|v| v.as_str()).collect::<Vec<_>>();142 let param_names_and_values: Vec<(&str, Vec<String>)> = args143 .chunks_exact(2)144 .map(|pair| {
69 unmodified lines
214 }215216 Ok(Self(commands))217 } else {210 let command_names = command_names.map_or(vec![], |names| names.map(|v| v.as_str()).collect::<Vec<_>>());218 let command_names = command_names.map_or(vec![], |names| {219 names.map(|v| v.as_str()).collect::<Vec<_>>()220 });221 if command_names.len() > command_strings.len() {222 return Err(OptionsError::TooManyCommandNames(command_strings.len()).into());223 }224
72 unmodified lines
297 command_strings: Vec<&'b str>,298 mut vals: ValuesRef<'b, String>,299 step: Option<&str>,300 ) -> Result<Vec<Command<'b>>, ParameterScanError> {291 let command_names = command_names.map_or(vec![], |names| names.map(|v| v.as_str()).collect::<Vec<_>>());301 let command_names = command_names.map_or(vec![], |names| {302 names.map(|v| v.as_str()).collect::<Vec<_>>()303 });304 let command_strings = command_strings;305 let param_name = vals.next().unwrap().as_str();306 let param_min = vals.next().unwrap().as_str();307 let param_max = vals.next().unwrap().as_str();
240 unmodified lines
modified:src/options.rs+4 added-1 removed
323 unmodified lines
324325 options.executor_kind = if matches.get_flag("no-shell") {326 ExecutorKind::Raw327 } else {328 match (matches.get_flag("debug-mode"), matches.get_one::<String>("shell")) {328 match (329 matches.get_flag("debug-mode"),330 matches.get_one::<String>("shell"),331 ) {332 (false, Some(shell)) if shell == "default" => ExecutorKind::Shell(Shell::default()),333 (false, Some(shell)) if shell == "none" => ExecutorKind::Raw,334 (false, Some(shell)) => ExecutorKind::Shell(Shell::parse_from_str(shell)?),335 (false, None) => ExecutorKind::Shell(Shell::default()),
81 unmodified lines