From 7cfeba0d22e60a8b69ad690635cef02fcdd8f6d2 Mon Sep 17 00:00:00 2001 From: Cheng-Hao Date: Mon, 20 Feb 2023 16:29:20 -0800 Subject: [PATCH 1/2] mkdir: move help strings to markdown file --- src/uu/mkdir/mkdir.md | 11 +++++++++++ src/uu/mkdir/src/mkdir.rs | 9 ++++----- 2 files changed, 15 insertions(+), 5 deletions(-) create mode 100644 src/uu/mkdir/mkdir.md diff --git a/src/uu/mkdir/mkdir.md b/src/uu/mkdir/mkdir.md new file mode 100644 index 000000000..79deafc46 --- /dev/null +++ b/src/uu/mkdir/mkdir.md @@ -0,0 +1,11 @@ +# mkdir + +``` +mkdir [OPTION]... [USER] +``` + +Create the given DIRECTORY(ies) if they do not exist + +## Long Usage + +Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'. diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index 9aced8ba5..ab92e7e74 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -18,14 +18,13 @@ use uucore::error::{UResult, USimpleError}; #[cfg(not(windows))] use uucore::mode; use uucore::{display::Quotable, fs::dir_strip_dot_for_creation}; -use uucore::{format_usage, show, show_if_err}; +use uucore::{format_usage, help_about, help_section, help_usage, show, show_if_err}; static DEFAULT_PERM: u32 = 0o755; -const ABOUT: &str = "Create the given DIRECTORY(ies) if they do not exist"; -const USAGE: &str = "{} [OPTION]... [USER]"; -const LONG_USAGE: &str = - "Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'."; +const ABOUT: &str = help_about!("mkdir.md"); +const USAGE: &str = help_usage!("mkdir.md"); +const LONG_USAGE: &str = help_section!("long usage", "mkdir.md"); mod options { pub const MODE: &str = "mode"; From e6fec39db136014d64bc0ddecf464424ecb764a8 Mon Sep 17 00:00:00 2001 From: Cheng-Hao Date: Tue, 21 Feb 2023 11:05:35 -0800 Subject: [PATCH 2/2] mkdir: update markdown naming for consistency --- src/uu/mkdir/mkdir.md | 2 +- src/uu/mkdir/src/mkdir.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/uu/mkdir/mkdir.md b/src/uu/mkdir/mkdir.md index 79deafc46..1a6041a7e 100644 --- a/src/uu/mkdir/mkdir.md +++ b/src/uu/mkdir/mkdir.md @@ -6,6 +6,6 @@ mkdir [OPTION]... [USER] Create the given DIRECTORY(ies) if they do not exist -## Long Usage +## After Help Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'. diff --git a/src/uu/mkdir/src/mkdir.rs b/src/uu/mkdir/src/mkdir.rs index ab92e7e74..9f490ecf9 100644 --- a/src/uu/mkdir/src/mkdir.rs +++ b/src/uu/mkdir/src/mkdir.rs @@ -24,7 +24,7 @@ static DEFAULT_PERM: u32 = 0o755; const ABOUT: &str = help_about!("mkdir.md"); const USAGE: &str = help_usage!("mkdir.md"); -const LONG_USAGE: &str = help_section!("long usage", "mkdir.md"); +const AFTER_HELP: &str = help_section!("after help", "mkdir.md"); mod options { pub const MODE: &str = "mode"; @@ -89,7 +89,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { // Linux-specific options, not implemented // opts.optflag("Z", "context", "set SELinux security context" + // " of each created directory to CTX"), - let matches = uu_app().after_help(LONG_USAGE).try_get_matches_from(args)?; + let matches = uu_app().after_help(AFTER_HELP).try_get_matches_from(args)?; let dirs = matches .get_many::(options::DIRS)