1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #3285 from sylvestre/ls_aA

ls: when -aA are provided, the order matters
This commit is contained in:
Terts Diepraam 2022-03-21 18:14:13 +01:00 committed by GitHub
commit 5eeac5881a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 50 additions and 0 deletions

View file

@ -1202,12 +1202,18 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(options::files::ALL) Arg::new(options::files::ALL)
.short('a') .short('a')
.long(options::files::ALL) .long(options::files::ALL)
// Overrides -A (as the order matters)
.overrides_with(options::files::ALMOST_ALL)
.multiple_occurrences(true)
.help("Do not ignore hidden files (files with names that start with '.')."), .help("Do not ignore hidden files (files with names that start with '.')."),
) )
.arg( .arg(
Arg::new(options::files::ALMOST_ALL) Arg::new(options::files::ALMOST_ALL)
.short('A') .short('A')
.long(options::files::ALMOST_ALL) .long(options::files::ALMOST_ALL)
// Overrides -a (as the order matters)
.overrides_with(options::files::ALL)
.multiple_occurrences(true)
.help( .help(
"In a directory, do not ignore all file names that start with '.', \ "In a directory, do not ignore all file names that start with '.', \
only ignore '.' and '..'.", only ignore '.' and '..'.",

View file

@ -2869,3 +2869,47 @@ fn test_ls_context_format() {
); );
} }
} }
#[test]
#[allow(non_snake_case)]
fn test_ls_a_A() {
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.arg("-A")
.arg("-a")
.succeeds()
.stdout_contains(".")
.stdout_contains("..");
scene
.ucmd()
.arg("-a")
.arg("-A")
.succeeds()
.stdout_does_not_contain(".")
.stdout_does_not_contain("..");
}
#[test]
#[allow(non_snake_case)]
fn test_ls_multiple_a_A() {
let scene = TestScenario::new(util_name!());
scene
.ucmd()
.arg("-a")
.arg("-a")
.succeeds()
.stdout_contains(".")
.stdout_contains("..");
scene
.ucmd()
.arg("-A")
.arg("-A")
.succeeds()
.stdout_does_not_contain(".")
.stdout_does_not_contain("..");
}