diff --git a/src/uu/tee/src/tee.rs b/src/uu/tee/src/tee.rs index b1443dbb9..69d66fd60 100644 --- a/src/uu/tee/src/tee.rs +++ b/src/uu/tee/src/tee.rs @@ -89,6 +89,16 @@ pub fn uu_app() -> Command { .override_usage(format_usage(USAGE)) .after_help(AFTER_HELP) .infer_long_args(true) + // Since we use value-specific help texts for "--output-error", clap's "short help" and "long help" differ. + // However, this is something that the GNU tests explicitly test for, so we *always* show the long help instead. + .disable_help_flag(true) + .arg( + Arg::new("--help") + .short('h') + .long("help") + .help("Print help") + .action(ArgAction::HelpLong) + ) .arg( Arg::new(options::APPEND) .long(options::APPEND) diff --git a/tests/by-util/test_tee.rs b/tests/by-util/test_tee.rs index 9ff4ea7dc..6058be076 100644 --- a/tests/by-util/test_tee.rs +++ b/tests/by-util/test_tee.rs @@ -18,6 +18,22 @@ fn test_invalid_arg() { new_ucmd!().arg("--definitely-invalid").fails().code_is(1); } +#[test] +fn test_short_help_is_long_help() { + // I can't believe that this test is necessary. + let help_short = new_ucmd!() + .arg("-h") + .succeeds() + .no_stderr() + .stdout_str() + .to_owned(); + new_ucmd!() + .arg("--help") + .succeeds() + .no_stderr() + .stdout_is(help_short); +} + #[test] fn test_tee_processing_multiple_operands() { // POSIX says: "Processing of at least 13 file operands shall be supported."