Skip to content

Commit

Permalink
Merge pull request uutils#6115 from BenWiederhake/dev-factor-repeat
Browse files Browse the repository at this point in the history
factor: correctly handle repeated flag
  • Loading branch information
sylvestre authored Mar 24, 2024
2 parents b168d1e + 3880218 commit 82550b4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/uu/factor/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ pub fn uu_app() -> Command {
.override_usage(format_usage(USAGE))
.infer_long_args(true)
.disable_help_flag(true)
.args_override_self(true)
.arg(Arg::new(options::NUMBER).action(ArgAction::Append))
.arg(
Arg::new(options::EXPONENTS)
Expand Down
9 changes: 9 additions & 0 deletions tests/by-util/test_factor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ fn test_valid_arg_exponents() {
new_ucmd!().arg("--exponents").succeeds().code_is(0);
}

#[test]
fn test_repeated_exponents() {
new_ucmd!()
.args(&["-hh", "1234", "10240"])
.succeeds()
.stdout_only("1234: 2 617\n10240: 2^11 5\n")
.no_stderr();
}

#[test]
#[cfg(feature = "sort")]
#[cfg(not(target_os = "android"))]
Expand Down

0 comments on commit 82550b4

Please sign in to comment.