diff --git a/src/uu/tail/src/args.rs b/src/uu/tail/src/args.rs index 6ae5e68bd..5cadac608 100644 --- a/src/uu/tail/src/args.rs +++ b/src/uu/tail/src/args.rs @@ -16,6 +16,7 @@ use std::io::IsTerminal; use std::time::Duration; use uucore::error::{UResult, USimpleError, UUsageError}; use uucore::parse_size::{parse_size_u64, ParseSizeError}; +use uucore::shortcut_value_parser::ShortcutValueParser; use uucore::{format_usage, help_about, help_usage, show_warning}; const ABOUT: &str = help_about!("tail.md"); @@ -494,7 +495,7 @@ pub fn uu_app() -> Command { .default_missing_value("descriptor") .num_args(0..=1) .require_equals(true) - .value_parser(["descriptor", "name"]) + .value_parser(ShortcutValueParser::new(["descriptor", "name"])) .overrides_with(options::FOLLOW) .help("Print the file as it grows"), ) diff --git a/tests/by-util/test_tail.rs b/tests/by-util/test_tail.rs index cc5a76c31..f11eac190 100644 --- a/tests/by-util/test_tail.rs +++ b/tests/by-util/test_tail.rs @@ -533,37 +533,40 @@ fn test_follow_multiple() { #[test] #[cfg(not(target_os = "windows"))] // FIXME: test times out fn test_follow_name_multiple() { - let (at, mut ucmd) = at_and_ucmd!(); - let mut child = ucmd - .arg("--follow=name") - .arg(FOOBAR_TXT) - .arg(FOOBAR_2_TXT) - .run_no_wait(); + // spell-checker:disable-next-line + for argument in ["--follow=name", "--follo=nam", "--f=n"] { + let (at, mut ucmd) = at_and_ucmd!(); + let mut child = ucmd + .arg(argument) + .arg(FOOBAR_TXT) + .arg(FOOBAR_2_TXT) + .run_no_wait(); - child - .make_assertion_with_delay(500) - .is_alive() - .with_current_output() - .stdout_only_fixture("foobar_follow_multiple.expected"); + child + .make_assertion_with_delay(500) + .is_alive() + .with_current_output() + .stdout_only_fixture("foobar_follow_multiple.expected"); - let first_append = "trois\n"; - at.append(FOOBAR_2_TXT, first_append); + let first_append = "trois\n"; + at.append(FOOBAR_2_TXT, first_append); - child - .make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS) - .with_current_output() - .stdout_only(first_append); + child + .make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS) + .with_current_output() + .stdout_only(first_append); - let second_append = "twenty\nthirty\n"; - at.append(FOOBAR_TXT, second_append); + let second_append = "twenty\nthirty\n"; + at.append(FOOBAR_TXT, second_append); - child - .make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS) - .with_current_output() - .stdout_only_fixture("foobar_follow_multiple_appended.expected"); + child + .make_assertion_with_delay(DEFAULT_SLEEP_INTERVAL_MILLIS) + .with_current_output() + .stdout_only_fixture("foobar_follow_multiple_appended.expected"); - child.make_assertion().is_alive(); - child.kill(); + child.make_assertion().is_alive(); + child.kill(); + } } #[test] @@ -844,7 +847,7 @@ fn test_follow_missing() { // Ensure that --follow=name does not imply --retry. // Ensure that --follow={descriptor,name} (without --retry) does *not wait* for the // file to appear. - for follow_mode in &["--follow=descriptor", "--follow=name"] { + for follow_mode in &["--follow=descriptor", "--follow=name", "--fo=d", "--fo=n"] { new_ucmd!() .arg(follow_mode) .arg("missing")