Rename to get_command_line
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by David Peter · committed by David Peter · parent defafdf · Browse files · 2 files·+14 added−14 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
2 files+14 added−14 removed
- other:+14 added−14 removed
Provenance
- Commit
826449b- Tree
90a4a77- Author
David Peter <mail@david-peter.de>- Committer
David Peter <sharkdp@users.noreply.github.com>- Parent
defafdf
2 files changed+14 added−14 removed
modified:src/benchmark/executor.rs+2 added-2 removed
59 unmodified lines60 CommandOutputPolicy::Forward => (Stdio::inherit(), Stdio::inherit()),61 };62 63 let wallclock_timer = WallClockTimer::start();64- let result = execute_and_time(stdout, stderr, &command.get_shell_command(), self.shell)?;64+ let result = execute_and_time(stdout, stderr, &command.get_command_line(), self.shell)?;65 let mut time_real = wallclock_timer.stop();66 67 let mut time_user = result.user_time;68 let mut time_system = result.system_time;132 unmodified lines201 };202 203 Ok((204 TimingResult {205- time_real: Self::extract_time(command.get_shell_command()),205+ time_real: Self::extract_time(command.get_command_line()),206 time_user: 0.0,207 time_system: 0.0,208 },209 status,19 unmodified linesmodified:src/command.rs+12 added-12 removed
53 unmodified lines54 }55 56 pub fn get_name(&self) -> String {57 self.name.map_or_else(58- || self.get_shell_command(),58+ || self.get_command_line(),59 |name| self.replace_parameters_in(name),60 )61 }62 63- pub fn get_shell_command(&self) -> String {63+ pub fn get_command_line(&self) -> String {64 self.replace_parameters_in(self.expression)65 }66 67 pub fn get_parameters(&self) -> &[(&'a str, ParameterValue)] {13 unmodified lines81 // Manually replace consecutive occurrences to avoid double-replacing: e.g.,82 //83 // hyperfine -L foo 'a,{bar}' -L bar 'baz,quux' 'echo {foo} {bar}'84 //85- // should not ever run 'echo baz baz'. See `test_get_shell_command_nonoverlapping`.85+ // should not ever run 'echo baz baz'. See `test_get_command_line_nonoverlapping`.86 'outer: while let Some(head) = remaining.chars().next() {87 for (k, v) in &replacements {88 if remaining.starts_with(k.as_str()) {89 result.push_str(v);227 unmodified lines317 }318 }319 320 #[test]321-fn test_get_shell_command_nonoverlapping() {321+fn test_get_command_line_nonoverlapping() {322 let cmd = Command::new_parametrized(323 None,324 "echo {foo} {bar}",325 vec![326 ("foo", ParameterValue::Text("{bar} baz".into())),327 ("bar", ParameterValue::Text("quux".into())),328 ],329 );330- assert_eq!(cmd.get_shell_command(), "echo {bar} baz quux");330+ assert_eq!(cmd.get_command_line(), "echo {bar} baz quux");331 }332 333 #[test]334 fn test_get_parameterized_command_name() {9 unmodified lines344 }345 346 impl<'a> fmt::Display for Command<'a> {347 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {348- write!(f, "{}", self.get_shell_command())348+ write!(f, "{}", self.get_command_line())349 }350 }351 352 #[test]50 unmodified lines403 let commands = Commands::from_cli_arguments(&matches).unwrap().0;404 assert_eq!(commands.len(), 2);405 assert_eq!(commands[0].get_name(), "name-1");406 assert_eq!(commands[1].get_name(), "name-2");407- assert_eq!(commands[0].get_shell_command(), "echo 1");408- assert_eq!(commands[1].get_shell_command(), "echo 2");407+ assert_eq!(commands[0].get_command_line(), "echo 1");408+ assert_eq!(commands[1].get_command_line(), "echo 2");409 }410 411 #[test]412 fn test_build_parameter_scan_commands() {13 unmodified lines426 let commands = Commands::from_cli_arguments(&matches).unwrap().0;427 assert_eq!(commands.len(), 2);428 assert_eq!(commands[0].get_name(), "name-1");429 assert_eq!(commands[1].get_name(), "name-2");430- assert_eq!(commands[0].get_shell_command(), "echo 1");431- assert_eq!(commands[1].get_shell_command(), "echo 2");430+ assert_eq!(commands[0].get_command_line(), "echo 1");431+ assert_eq!(commands[1].get_command_line(), "echo 2");432 }433 434 #[test]435 fn test_parameter_scan_commands_int() {7 unmodified lines443 )444 .unwrap();445 assert_eq!(commands.len(), 3);446 assert_eq!(commands[2].get_name(), "echo 7");447- assert_eq!(commands[2].get_shell_command(), "echo 7");447+ assert_eq!(commands[2].get_command_line(), "echo 7");448 }449 450 #[test]451 fn test_parameter_scan_commands_decimal() {11 unmodified lines463 )464 .unwrap();465 assert_eq!(commands.len(), 4);466 assert_eq!(commands[3].get_name(), "echo 0.99");467- assert_eq!(commands[3].get_shell_command(), "echo 0.99");467+ assert_eq!(commands[3].get_command_line(), "echo 0.99");468 }469 470 #[test]471 fn test_parameterr_scan_commands_names() {51 unmodified lines