Skip to content

Commit 9dbf2c3

Browse files
BenWiederhakesylvestre
authored andcommitted
dirname: accept repeated flag
1 parent c99e1c6 commit 9dbf2c3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/uu/dirname/src/dirname.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ pub fn uu_app() -> Command {
6464
.about(ABOUT)
6565
.version(crate_version!())
6666
.override_usage(format_usage(USAGE))
67+
.args_override_self(true)
6768
.infer_long_args(true)
6869
.arg(
6970
Arg::new(options::ZERO)

tests/by-util/test_dirname.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ fn test_path_without_trailing_slashes_and_zero() {
4040
.stdout_is("/root/alpha/beta/gamma/delta/epsilon\u{0}");
4141
}
4242

43+
#[test]
44+
fn test_repeated_zero() {
45+
new_ucmd!()
46+
.arg("--zero")
47+
.arg("--zero")
48+
.arg("foo/bar")
49+
.succeeds()
50+
.stdout_only("foo\u{0}");
51+
}
52+
4353
#[test]
4454
fn test_root() {
4555
new_ucmd!().arg("/").run().stdout_is("/\n");

0 commit comments

Comments
 (0)