Skip to content

Commit

Permalink
cat: fix -b and -n anti-symmetry
Browse files Browse the repository at this point in the history
  • Loading branch information
BenWiederhake committed Mar 1, 2024
1 parent 713bf5e commit 44cd7b4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/uu/cat/src/cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ pub fn uu_app() -> Command {
.short('b')
.long(options::NUMBER_NONBLANK)
.help("number nonempty output lines, overrides -n")
.overrides_with(options::NUMBER)
// Note: This MUST NOT .overrides_with(options::NUMBER)!
// In clap, overriding is symmetric, so "-b -n" counts as "-n", which is not what we want.
.action(ArgAction::SetTrue),
)
.arg(
Expand Down
1 change: 0 additions & 1 deletion tests/by-util/test_cat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,6 @@ fn test_non_blank_overrides_number() {
}

#[test]
#[ignore = "known issue"]
fn test_non_blank_overrides_number_even_when_present() {
new_ucmd!()
.args(&["-n", "-b", "-n"])
Expand Down

0 comments on commit 44cd7b4

Please sign in to comment.