1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2026-01-16 18:21:01 +00:00

fix: match date -I error messages with GNU date (#4499)

* date: use value_parser to improve errors

* date: update panic! to unreachable inside impl From for Iso8601Format
This commit is contained in:
Surya Teja K 2023-03-17 01:20:37 +05:30 committed by GitHub
parent 4e03e6254f
commit bd6905cf59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View file

@ -114,8 +114,8 @@ impl<'a> From<&'a str> for Iso8601Format {
SECONDS | SECOND => Self::Seconds,
NS => Self::Ns,
DATE => Self::Date,
// Should be caught by clap
_ => panic!("Invalid format: {s}"),
// Note: This is caught by clap via `possible_values`
_ => unreachable!(),
}
}
}
@ -291,6 +291,7 @@ pub fn uu_app() -> Command {
.short('I')
.long(OPT_ISO_8601)
.value_name("FMT")
.value_parser([DATE, HOUR, HOURS, MINUTE, MINUTES, SECOND, SECONDS, NS])
.help(ISO_8601_HELP_STRING),
)
.arg(