Skip to content

Commit

Permalink
ls: when -aA are provided, the order matters
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Mar 20, 2022
1 parent 04b219b commit af8726a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/uu/ls/src/ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1202,12 +1202,14 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(options::files::ALL)
.short('a')
.long(options::files::ALL)
.overrides_with(options::files::ALMOST_ALL)
.help("Do not ignore hidden files (files with names that start with '.')."),
)
.arg(
Arg::new(options::files::ALMOST_ALL)
.short('A')
.long(options::files::ALMOST_ALL)
.overrides_with(options::files::ALL)
.help(
"In a directory, do not ignore all file names that start with '.', \
only ignore '.' and '..'.",
Expand Down
22 changes: 22 additions & 0 deletions tests/by-util/test_ls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2869,3 +2869,25 @@ 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("..");
}

0 comments on commit af8726a

Please sign in to comment.