From af8726af4307825a7eed3f60eeb5e9449a03ba99 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 20 Mar 2022 19:58:21 +0100 Subject: [PATCH] ls: when -aA are provided, the order matters --- src/uu/ls/src/ls.rs | 2 ++ tests/by-util/test_ls.rs | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index fa1900bbb..d7562c29e 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -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 '..'.", diff --git a/tests/by-util/test_ls.rs b/tests/by-util/test_ls.rs index bb3b24670..540381cc0 100644 --- a/tests/by-util/test_ls.rs +++ b/tests/by-util/test_ls.rs @@ -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(".."); +}