mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-29 03:57:44 +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 foreground = options.is_present(options::FOREGROUND);
|
||||||
|
|
||||||
let command: String = options.value_of(options::COMMAND).unwrap().to_string();
|
let command: String = options.value_of(options::COMMAND).unwrap().to_string();
|
||||||
let command_args: Vec<String> = options
|
|
||||||
.values_of(options::ARGS)
|
let command_args: Vec<String> = match options.values_of(options::ARGS) {
|
||||||
.unwrap()
|
Some(values) => values.map(|x| x.to_owned()).collect(),
|
||||||
.map(|x| x.to_owned())
|
None => vec![],
|
||||||
.collect();
|
};
|
||||||
|
|
||||||
Config {
|
Config {
|
||||||
foreground,
|
foreground,
|
||||||
|
@ -137,7 +137,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
|
||||||
.required(true)
|
.required(true)
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name(options::ARGS).required(true).multiple(true)
|
Arg::with_name(options::ARGS).multiple(true)
|
||||||
)
|
)
|
||||||
.setting(AppSettings::TrailingVarArg);
|
.setting(AppSettings::TrailingVarArg);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue