diff --git a/src/uu/head/src/cli.rs b/src/uu/head/src/cli.rs index 823d3869116..ed308ffbf91 100644 --- a/src/uu/head/src/cli.rs +++ b/src/uu/head/src/cli.rs @@ -79,6 +79,7 @@ pub fn uu_app() -> Command { Arg::new(options::FILES) .action(ArgAction::Append) .value_parser(clap::value_parser!(OsString)) + .default_value("-") .value_hint(clap::ValueHint::FilePath), ) } diff --git a/src/uu/head/src/head.rs b/src/uu/head/src/head.rs index 955b3334dfd..24ff9e5c045 100644 --- a/src/uu/head/src/head.rs +++ b/src/uu/head/src/head.rs @@ -150,11 +150,12 @@ impl HeadOptions { options.presume_input_pipe = matches.get_flag(options::PRESUME_INPUT_PIPE); options.mode = Mode::from(matches)?; - - options.files = match matches.get_many::(options::FILES) { - Some(v) => v.cloned().collect(), - None => vec![OsString::from("-")], - }; + // #[allow(clippy::unwrap_used, reason = "clap provides '-' by default")] + options.files = matches + .get_many::(options::FILES) + .unwrap() + .cloned() + .collect(); Ok(options) }