1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-14 11:07:59 +00:00

cp: fix "after help" output

This commit is contained in:
Daniel Hofstetter 2023-05-05 16:12:34 +02:00
parent 4ee1118061
commit 4481604f87

View file

@ -299,7 +299,10 @@ pub fn uu_app() -> Command {
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .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) .infer_long_args(true)
.arg( .arg(
Arg::new(options::TARGET_DIRECTORY) Arg::new(options::TARGET_DIRECTORY)
@ -561,13 +564,11 @@ pub fn uu_app() -> Command {
#[uucore::main] #[uucore::main]
pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uumain(args: impl uucore::Args) -> UResult<()> {
let matches = uu_app() let matches = uu_app().try_get_matches_from(args);
.after_help(backup_control::BACKUP_CONTROL_LONG_HELP)
.try_get_matches_from(args);
// The error is parsed here because we do not want version or help being printed to stderr. // The error is parsed here because we do not want version or help being printed to stderr.
if let Err(e) = matches { 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() { match e.kind() {
clap::error::ErrorKind::DisplayHelp => { clap::error::ErrorKind::DisplayHelp => {