date: Fix format optional argument to capture all following parameters (#10914)

This commit is contained in:
cerdelen
2026-02-13 16:13:01 -05:00
committed by GitHub
parent 93ae9346a9
commit e4b3b5ca72
2 changed files with 10 additions and 1 deletions
+1 -1
View File
@@ -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(
+9
View File
@@ -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!()