mirror of
https://github.com/uutils/coreutils
synced 2024-12-14 07:12:44 +00:00
date: Added default value for date --i
.
`default_missing_value` set to `OPT_DATE` (`"date"`) `num_args(0..=1)` required for `default_missing_value`. Using function name `test_date_rfc_8601_default`. The function name `test_date_rfc_8601` is left intact for compatibility. Fixes: #4521
This commit is contained in:
parent
5298ba8250
commit
624588d37f
2 changed files with 10 additions and 0 deletions
|
@ -292,6 +292,8 @@ pub fn uu_app() -> Command {
|
|||
.long(OPT_ISO_8601)
|
||||
.value_name("FMT")
|
||||
.value_parser([DATE, HOUR, HOURS, MINUTE, MINUTES, SECOND, SECONDS, NS])
|
||||
.num_args(0..=1)
|
||||
.default_missing_value(OPT_DATE)
|
||||
.help(ISO_8601_HELP_STRING),
|
||||
)
|
||||
.arg(
|
||||
|
|
|
@ -43,6 +43,14 @@ fn test_date_rfc_3339() {
|
|||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_date_rfc_8601_default() {
|
||||
let re = Regex::new(r"^\d{4}-\d{2}-\d{2}\n$").unwrap();
|
||||
for param in ["--iso-8601", "--i"] {
|
||||
new_ucmd!().arg(param).succeeds().stdout_matches(&re);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_date_rfc_8601() {
|
||||
let re = Regex::new(r"^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2},\d{9}[+-]\d{2}:\d{2}\n$").unwrap();
|
||||
|
|
Loading…
Reference in a new issue