date: allow multiple -d, last wins

This commit is contained in:
Daniel Hofstetter
2025-08-22 10:16:17 +02:00
parent c1443bdd4e
commit 703084ee5e
2 changed files with 14 additions and 0 deletions
+1
View File
@@ -275,6 +275,7 @@ pub fn uu_app() -> Command {
.long(OPT_DATE)
.value_name("STRING")
.allow_hyphen_values(true)
.overrides_with(OPT_DATE)
.help(translate!("date-help-date")),
)
.arg(
+13
View File
@@ -504,6 +504,19 @@ fn test_invalid_date_string() {
.stderr_contains("invalid date");
}
#[test]
fn test_multiple_dates() {
new_ucmd!()
.arg("-d")
.arg("invalid")
.arg("-d")
.arg("2000-02-02")
.arg("+%Y")
.succeeds()
.stdout_is("2000\n")
.no_stderr();
}
#[test]
fn test_date_one_digit_date() {
new_ucmd!()