diff --git a/src/uu/paste/src/paste.rs b/src/uu/paste/src/paste.rs index 2a7f896c34b..f12a85a663d 100644 --- a/src/uu/paste/src/paste.rs +++ b/src/uu/paste/src/paste.rs @@ -65,6 +65,7 @@ pub fn uu_app() -> Command { .value_name("LIST") .default_value("\t") .hide_default_value(true) + .allow_hyphen_values(true) .value_parser(clap::value_parser!(OsString)), ) .arg( diff --git a/tests/by-util/test_paste.rs b/tests/by-util/test_paste.rs index c07b0fcaaa5..4d9c8ca7e36 100644 --- a/tests/by-util/test_paste.rs +++ b/tests/by-util/test_paste.rs @@ -166,6 +166,19 @@ fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails_with_code(1); } +#[test] +fn test_delimiter_hyphen_leading_as_separate_arg() { + // A hyphen-leading delimiter value passed as its own argument (not + // attached with `-d-x`/`=`) must not be mistaken for a new, + // unrecognized flag. + let (at, mut ucmd) = at_and_ucmd!(); + at.write("f1", "a\nb\n"); + at.write("f2", "1\n2\n"); + ucmd.args(&["-d", "-x", "f1", "f2"]) + .succeeds() + .stdout_is("a-1\nb-2\n"); +} + #[test] fn test_combine_pairs_of_lines() { for s in ["-s", "--serial"] {