From 4481604f87bde396b98744290bdf1dd536df4fdd Mon Sep 17 00:00:00 2001 From: Daniel Hofstetter Date: Fri, 5 May 2023 16:12:34 +0200 Subject: [PATCH] cp: fix "after help" output --- src/uu/cp/src/cp.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/uu/cp/src/cp.rs b/src/uu/cp/src/cp.rs index 54616e75e..270335b97 100644 --- a/src/uu/cp/src/cp.rs +++ b/src/uu/cp/src/cp.rs @@ -299,7 +299,10 @@ pub fn uu_app() -> Command { .version(crate_version!()) .about(ABOUT) .override_usage(format_usage(USAGE)) - .after_help(AFTER_HELP) + .after_help(format!( + "{AFTER_HELP}\n\n{}", + backup_control::BACKUP_CONTROL_LONG_HELP + )) .infer_long_args(true) .arg( Arg::new(options::TARGET_DIRECTORY) @@ -561,13 +564,11 @@ pub fn uu_app() -> Command { #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { - let matches = uu_app() - .after_help(backup_control::BACKUP_CONTROL_LONG_HELP) - .try_get_matches_from(args); + let matches = uu_app().try_get_matches_from(args); // The error is parsed here because we do not want version or help being printed to stderr. if let Err(e) = matches { - let mut app = uu_app().after_help(backup_control::BACKUP_CONTROL_LONG_HELP); + let mut app = uu_app(); match e.kind() { clap::error::ErrorKind::DisplayHelp => {