From d90a81fb464fc6d0c8683b6e2ef45ccb734d5c63 Mon Sep 17 00:00:00 2001 From: Terts Diepraam Date: Sun, 20 Mar 2022 10:14:32 +0100 Subject: [PATCH] all utils: remove short help flag if another -h flag is present --- src/uu/chcon/src/chcon.rs | 6 ++++++ src/uu/chgrp/src/chgrp.rs | 5 +++++ src/uu/chown/src/chown.rs | 5 +++++ src/uu/df/src/df.rs | 6 ++++++ src/uu/du/src/du.rs | 6 ++++++ src/uu/ls/src/ls.rs | 6 ++++++ src/uu/nl/src/nl.rs | 6 ++++++ src/uu/od/src/od.rs | 6 ++++++ src/uu/sort/src/sort.rs | 6 ++++++ src/uu/touch/src/touch.rs | 6 ++++++ src/uucore/src/lib/features/perms.rs | 1 + 11 files changed, 59 insertions(+) diff --git a/src/uu/chcon/src/chcon.rs b/src/uu/chcon/src/chcon.rs index 8f5e0f26b..4d589eddd 100644 --- a/src/uu/chcon/src/chcon.rs +++ b/src/uu/chcon/src/chcon.rs @@ -29,6 +29,7 @@ const USAGE: &str = "\ {} [OPTION]... --reference=RFILE FILE..."; pub mod options { + pub static HELP: &str = "help"; pub static VERBOSE: &str = "verbose"; pub static REFERENCE: &str = "reference"; @@ -160,6 +161,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information."), + ) .arg( Arg::new(options::dereference::DEREFERENCE) .long(options::dereference::DEREFERENCE) diff --git a/src/uu/chgrp/src/chgrp.rs b/src/uu/chgrp/src/chgrp.rs index ce1cb5f37..d7e8baafe 100644 --- a/src/uu/chgrp/src/chgrp.rs +++ b/src/uu/chgrp/src/chgrp.rs @@ -60,6 +60,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information.") + ) .arg( Arg::new(options::verbosity::CHANGES) .short('c') diff --git a/src/uu/chown/src/chown.rs b/src/uu/chown/src/chown.rs index c1d7d1420..3add9df1f 100644 --- a/src/uu/chown/src/chown.rs +++ b/src/uu/chown/src/chown.rs @@ -69,6 +69,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information."), + ) .arg( Arg::new(options::verbosity::CHANGES) .short('c') diff --git a/src/uu/df/src/df.rs b/src/uu/df/src/df.rs index 466d027bc..d41233139 100644 --- a/src/uu/df/src/df.rs +++ b/src/uu/df/src/df.rs @@ -29,6 +29,7 @@ static ABOUT: &str = "Show information about the file system on which each FILE or all file systems by default."; const USAGE: &str = "{} [OPTION]... [FILE]..."; +static OPT_HELP: &str = "help"; static OPT_ALL: &str = "all"; static OPT_BLOCKSIZE: &str = "blocksize"; static OPT_DIRECT: &str = "direct"; @@ -322,6 +323,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(OPT_HELP) + .long(OPT_HELP) + .help("Print help information."), + ) .arg( Arg::new(OPT_ALL) .short('a') diff --git a/src/uu/du/src/du.rs b/src/uu/du/src/du.rs index 8d97b8b47..0690c6299 100644 --- a/src/uu/du/src/du.rs +++ b/src/uu/du/src/du.rs @@ -47,6 +47,7 @@ use winapi::um::winbase::GetFileInformationByHandleEx; use winapi::um::winnt::{FILE_ID_128, ULONGLONG}; mod options { + pub const HELP: &str = "help"; pub const NULL: &str = "0"; pub const ALL: &str = "all"; pub const APPARENT_SIZE: &str = "apparent-size"; @@ -624,6 +625,11 @@ pub fn uu_app<'a>() -> Command<'a> { .after_help(LONG_HELP) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information.") + ) .arg( Arg::new(options::ALL) .short('a') diff --git a/src/uu/ls/src/ls.rs b/src/uu/ls/src/ls.rs index a7dbc7b42..fa1900bbb 100644 --- a/src/uu/ls/src/ls.rs +++ b/src/uu/ls/src/ls.rs @@ -116,6 +116,7 @@ pub mod options { pub static DIR_ARGS: &str = "dereference-command-line-symlink-to-dir"; } + pub static HELP: &str = "help"; pub static QUOTING_STYLE: &str = "quoting-style"; pub static HIDE_CONTROL_CHARS: &str = "hide-control-chars"; pub static SHOW_CONTROL_CHARS: &str = "show-control-chars"; @@ -806,6 +807,11 @@ pub fn uu_app<'a>() -> Command<'a> { whose names start with '.'.", ) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information.") + ) // Format arguments .arg( Arg::new(options::FORMAT) diff --git a/src/uu/nl/src/nl.rs b/src/uu/nl/src/nl.rs index 09ad9a816..28cf3fb4d 100644 --- a/src/uu/nl/src/nl.rs +++ b/src/uu/nl/src/nl.rs @@ -66,6 +66,7 @@ enum NumberFormat { } pub mod options { + pub const HELP: &str = "help"; pub const FILE: &str = "file"; pub const BODY_NUMBERING: &str = "body-numbering"; pub const SECTION_DELIMITER: &str = "section-delimiter"; @@ -145,6 +146,11 @@ pub fn uu_app<'a>() -> Command<'a> { .version(crate_version!()) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information."), + ) .arg( Arg::new(options::FILE) .hide(true) diff --git a/src/uu/od/src/od.rs b/src/uu/od/src/od.rs index eeca0171a..81cfb94de 100644 --- a/src/uu/od/src/od.rs +++ b/src/uu/od/src/od.rs @@ -98,6 +98,7 @@ If an error occurred, a diagnostic message will be printed to stderr, and the exitcode will be non-zero."#; pub(crate) mod options { + pub const HELP: &str = "help"; pub const ADDRESS_RADIX: &str = "address-radix"; pub const SKIP_BYTES: &str = "skip-bytes"; pub const READ_BYTES: &str = "read-bytes"; @@ -299,6 +300,11 @@ pub fn uu_app<'a>() -> Command<'a> { .dont_delimit_trailing_values(true) .infer_long_args(true) .setting(AppSettings::DeriveDisplayOrder) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information.") + ) .arg( Arg::new(options::ADDRESS_RADIX) .short('A') diff --git a/src/uu/sort/src/sort.rs b/src/uu/sort/src/sort.rs index 70cebad4f..c6e1583a7 100644 --- a/src/uu/sort/src/sort.rs +++ b/src/uu/sort/src/sort.rs @@ -98,6 +98,7 @@ mod options { pub const DIAGNOSE_FIRST: &str = "diagnose-first"; } + pub const HELP: &str = "help"; pub const DICTIONARY_ORDER: &str = "dictionary-order"; pub const MERGE: &str = "merge"; pub const DEBUG: &str = "debug"; @@ -1274,6 +1275,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information."), + ) .arg( Arg::new(options::modes::SORT) .long(options::modes::SORT) diff --git a/src/uu/touch/src/touch.rs b/src/uu/touch/src/touch.rs index 220a8476e..864917574 100644 --- a/src/uu/touch/src/touch.rs +++ b/src/uu/touch/src/touch.rs @@ -31,6 +31,7 @@ pub mod options { pub static REFERENCE: &str = "reference"; pub static CURRENT: &str = "current"; } + pub static HELP: &str = "help"; pub static ACCESS: &str = "access"; pub static MODIFICATION: &str = "modification"; pub static NO_CREATE: &str = "no-create"; @@ -155,6 +156,11 @@ pub fn uu_app<'a>() -> Command<'a> { .about(ABOUT) .override_usage(format_usage(USAGE)) .infer_long_args(true) + .arg( + Arg::new(options::HELP) + .long(options::HELP) + .help("Print help information."), + ) .arg( Arg::new(options::ACCESS) .short('a') diff --git a/src/uucore/src/lib/features/perms.rs b/src/uucore/src/lib/features/perms.rs index 970b2fca9..d8e345313 100644 --- a/src/uucore/src/lib/features/perms.rs +++ b/src/uucore/src/lib/features/perms.rs @@ -383,6 +383,7 @@ impl ChownExecutor { } pub mod options { + pub const HELP: &str = "help"; pub mod verbosity { pub const CHANGES: &str = "changes"; pub const QUIET: &str = "quiet";