Merge pull request #5447 from cakebaker/ls_time_style_diag

ls: return exit code 2 for invalid time-style
This commit is contained in:
Sylvestre Ledru 2023-10-24 20:38:17 +02:00 committed by GitHub
commit 2e7d37ce86
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View file

@ -183,7 +183,7 @@ impl UError for LsError {
Self::BlockSizeParseError(_) => 1,
Self::ConflictingArgumentDired() => 1,
Self::AlreadyListedError(_) => 2,
Self::TimeStyleParseError(_, _) => 1,
Self::TimeStyleParseError(_, _) => 2,
}
}
}

View file

@ -1737,7 +1737,12 @@ fn test_ls_styles() {
.stdout_matches(&re_custom_format);
// Also fails due to not having full clap support for time_styles
scene.ucmd().arg("-l").arg("-time-style=invalid").fails();
scene
.ucmd()
.arg("-l")
.arg("--time-style=invalid")
.fails()
.code_is(2);
//Overwrite options tests
scene