From 8e794d0654ee0cd02e5c305c7f099febe4244e51 Mon Sep 17 00:00:00 2001 From: Ben Wiederhake Date: Sat, 30 Mar 2024 15:30:11 +0100 Subject: [PATCH] dircolors: accept repeated flags --- src/uu/dircolors/src/dircolors.rs | 1 + tests/by-util/test_dircolors.rs | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/uu/dircolors/src/dircolors.rs b/src/uu/dircolors/src/dircolors.rs index 531c3ee474..d581fc5ce2 100644 --- a/src/uu/dircolors/src/dircolors.rs +++ b/src/uu/dircolors/src/dircolors.rs @@ -258,6 +258,7 @@ pub fn uu_app() -> Command { .about(ABOUT) .after_help(AFTER_HELP) .override_usage(format_usage(USAGE)) + .args_override_self(true) .infer_long_args(true) .arg( Arg::new(options::BOURNE_SHELL) diff --git a/tests/by-util/test_dircolors.rs b/tests/by-util/test_dircolors.rs index 4a256352c7..d673681548 100644 --- a/tests/by-util/test_dircolors.rs +++ b/tests/by-util/test_dircolors.rs @@ -246,3 +246,10 @@ fn test_dircolors_for_dir_as_file() { "dircolors: expected file, got directory '/'", ); } + +#[test] +fn test_repeated() { + for arg in ["-b", "-c", "--print-database", "--print-ls-colors"] { + new_ucmd!().arg(arg).arg(arg).succeeds().no_stderr(); + } +}