Skip to content

Commit

Permalink
Merge pull request #5671 from Yykz/wc_args_override
Browse files Browse the repository at this point in the history
wc: fix arguments not overriding
  • Loading branch information
sylvestre authored Dec 18, 2023
2 parents 0fa074f + 652e02f commit ece9e91
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/uu/wc/src/wc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ pub fn uu_app() -> Command {
.about(ABOUT)
.override_usage(format_usage(USAGE))
.infer_long_args(true)
.args_override_self(true)
.arg(
Arg::new(options::BYTES)
.short('c')
Expand Down
13 changes: 13 additions & 0 deletions tests/by-util/test_wc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,3 +725,16 @@ fn files0_from_dir() {
.fails()
.stderr_only(dir_err!("-"));
}

#[test]
fn test_args_override() {
new_ucmd!()
.args(&["-ll", "-l", "alice_in_wonderland.txt"])
.run()
.stdout_is("5 alice_in_wonderland.txt\n");

new_ucmd!()
.args(&["--total=always", "--total=never", "alice_in_wonderland.txt"])
.run()
.stdout_is(" 5 57 302 alice_in_wonderland.txt\n");
}

0 comments on commit ece9e91

Please sign in to comment.