diff --git a/src/uu/date/src/date.rs b/src/uu/date/src/date.rs index 13c42ec74cc..2a22ee50a75 100644 --- a/src/uu/date/src/date.rs +++ b/src/uu/date/src/date.rs @@ -624,7 +624,7 @@ pub fn uu_app() -> Command { .help(translate!("date-help-universal")) .action(ArgAction::SetTrue), ) - .arg(Arg::new(OPT_FORMAT).num_args(0..).trailing_var_arg(true)) + .arg(Arg::new(OPT_FORMAT).num_args(0..)) } fn format_date_with_locale_aware_months( diff --git a/tests/by-util/test_date.rs b/tests/by-util/test_date.rs index 134a63843cd..bddbbaf78f3 100644 --- a/tests/by-util/test_date.rs +++ b/tests/by-util/test_date.rs @@ -51,6 +51,15 @@ fn test_invalid_short_option() { .stderr_contains("unexpected argument '-w'"); } +#[test] +fn test_format_option_not_to_capture_other_valid_arguments() { + new_ucmd!() + .arg("+%Y%m%d%H%M%S") + .arg("--date") + .arg("@1770996496") + .succeeds(); +} + #[test] fn test_single_dash_as_date() { new_ucmd!()