Skip to content

Commit 82550b4

Browse files
authored
Merge pull request #6115 from BenWiederhake/dev-factor-repeat
factor: correctly handle repeated flag
2 parents b168d1e + 3880218 commit 82550b4

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/uu/factor/src/cli.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ pub fn uu_app() -> Command {
103103
.override_usage(format_usage(USAGE))
104104
.infer_long_args(true)
105105
.disable_help_flag(true)
106+
.args_override_self(true)
106107
.arg(Arg::new(options::NUMBER).action(ArgAction::Append))
107108
.arg(
108109
Arg::new(options::EXPONENTS)

tests/by-util/test_factor.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ fn test_valid_arg_exponents() {
3030
new_ucmd!().arg("--exponents").succeeds().code_is(0);
3131
}
3232

33+
#[test]
34+
fn test_repeated_exponents() {
35+
new_ucmd!()
36+
.args(&["-hh", "1234", "10240"])
37+
.succeeds()
38+
.stdout_only("1234: 2 617\n10240: 2^11 5\n")
39+
.no_stderr();
40+
}
41+
3342
#[test]
3443
#[cfg(feature = "sort")]
3544
#[cfg(not(target_os = "android"))]

0 commit comments

Comments
 (0)