mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 12:07:46 +00:00
timeout: tests passing.
Forgot to handle the case where no arguments were passed to the COMMAND. Because ARGS can be empty, we need two separate cases for handling options.values_of(options::ARGS)
This commit is contained in:
parent
431a6ee1b5
commit
8232c527a3
1 changed files with 6 additions and 6 deletions
|
@ -79,11 +79,11 @@ impl Config {
|
|||
let foreground = options.is_present(options::FOREGROUND);
|
||||
|
||||
let command: String = options.value_of(options::COMMAND).unwrap().to_string();
|
||||
let command_args: Vec<String> = options
|
||||
.values_of(options::ARGS)
|
||||
.unwrap()
|
||||
.map(|x| x.to_owned())
|
||||
.collect();
|
||||
|
||||
let command_args: Vec<String> = match options.values_of(options::ARGS) {
|
||||
Some(values) => values.map(|x| x.to_owned()).collect(),
|
||||
None => vec![],
|
||||
};
|
||||
|
||||
Config {
|
||||
foreground,
|
||||
|
@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
|||
.required(true)
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name(options::ARGS).required(true).multiple(true)
|
||||
Arg::with_name(options::ARGS).multiple(true)
|
||||
)
|
||||
.setting(AppSettings::TrailingVarArg);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue