1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

factor: correctly handle repeated flag

This commit is contained in:
Ben Wiederhake 2024-03-24 00:06:44 +01:00
parent dcb53b6c99
commit 388021833e
2 changed files with 10 additions and 0 deletions

View file

@ -103,6 +103,7 @@ pub fn uu_app() -> Command {
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
.disable_help_flag(true) .disable_help_flag(true)
.args_override_self(true)
.arg(Arg::new(options::NUMBER).action(ArgAction::Append)) .arg(Arg::new(options::NUMBER).action(ArgAction::Append))
.arg( .arg(
Arg::new(options::EXPONENTS) Arg::new(options::EXPONENTS)

View file

@ -30,6 +30,15 @@ fn test_valid_arg_exponents() {
new_ucmd!().arg("--exponents").succeeds().code_is(0); 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] #[test]
#[cfg(feature = "sort")] #[cfg(feature = "sort")]
#[cfg(not(target_os = "android"))] #[cfg(not(target_os = "android"))]