From 7f00dfda7645a40031a02a5e6764051c1f2035e4 Mon Sep 17 00:00:00 2001 From: Koki Ueha Date: Sat, 18 Mar 2023 12:43:00 +0000 Subject: [PATCH 1/3] mknod: move help strings to markdown file --- src/uu/mknod/mknod.md | 27 +++++++++++++++++++++++++++ src/uu/mknod/src/mknod.rs | 27 +++++---------------------- 2 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 src/uu/mknod/mknod.md diff --git a/src/uu/mknod/mknod.md b/src/uu/mknod/mknod.md new file mode 100644 index 00000000000..4cb366df96d --- /dev/null +++ b/src/uu/mknod/mknod.md @@ -0,0 +1,27 @@ +# mknod + +``` +mknod [OPTION]... NAME TYPE [MAJOR MINOR] +``` + +Create the special file NAME of the given TYPE. + +## After Help + +Mandatory arguments to long options are mandatory for short options too. +-m, --mode=MODE set file permission bits to MODE, not a=rw - umask +--help display this help and exit +--version output version information and exit + +Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they +must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, +it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; +otherwise, as decimal. TYPE may be: + +b create a block (buffered) special file +c, u create a character (unbuffered) special file +p create a FIFO + +NOTE: your shell may have its own version of mknod, which usually supersedes +the version described here. Please refer to your shell's documentation +for details about the options it supports. diff --git a/src/uu/mknod/src/mknod.rs b/src/uu/mknod/src/mknod.rs index f4c6f573267..ad7618cc8a0 100644 --- a/src/uu/mknod/src/mknod.rs +++ b/src/uu/mknod/src/mknod.rs @@ -14,28 +14,11 @@ use std::ffi::CString; use uucore::display::Quotable; use uucore::error::{set_exit_code, UResult, USimpleError, UUsageError}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_section, help_usage}; -static ABOUT: &str = "Create the special file NAME of the given TYPE."; -static USAGE: &str = "{} [OPTION]... NAME TYPE [MAJOR MINOR]"; -static LONG_HELP: &str = "Mandatory arguments to long options are mandatory for short options too. --m, --mode=MODE set file permission bits to MODE, not a=rw - umask ---help display this help and exit ---version output version information and exit - -Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they -must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, -it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; -otherwise, as decimal. TYPE may be: - -b create a block (buffered) special file -c, u create a character (unbuffered) special file -p create a FIFO - -NOTE: your shell may have its own version of mknod, which usually supersedes -the version described here. Please refer to your shell's documentation -for details about the options it supports. -"; +const ABOUT: &str = help_about!("mknod.md"); +const USAGE: &str = help_usage!("mknod.md"); +const AFTER_HELP: &str = help_section!("after help", "mknod.md"); const MODE_RW_UGO: mode_t = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; @@ -142,7 +125,7 @@ pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) .override_usage(format_usage(USAGE)) - .after_help(LONG_HELP) + .after_help(AFTER_HELP) .about(ABOUT) .infer_long_args(true) .arg( From 8393118aeec213ce0e63f6a0f5e0c10d171615f2 Mon Sep 17 00:00:00 2001 From: papparapa <37232476+papparapa@users.noreply.github.com> Date: Sun, 19 Mar 2023 00:42:16 +0900 Subject: [PATCH 2/3] Update src/uu/mknod/mknod.md Co-authored-by: Sylvestre Ledru --- src/uu/mknod/mknod.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uu/mknod/mknod.md b/src/uu/mknod/mknod.md index 4cb366df96d..88034e76ada 100644 --- a/src/uu/mknod/mknod.md +++ b/src/uu/mknod/mknod.md @@ -9,9 +9,7 @@ Create the special file NAME of the given TYPE. ## After Help Mandatory arguments to long options are mandatory for short options too. --m, --mode=MODE set file permission bits to MODE, not a=rw - umask ---help display this help and exit ---version output version information and exit +`-m`, `--mode=MODE` set file permission bits to `MODE`, not `a=rw - umask` Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, From 3b78b2e92fa88bb3d4d1e13e182de70487028351 Mon Sep 17 00:00:00 2001 From: papparapa <37232476+papparapa@users.noreply.github.com> Date: Sun, 19 Mar 2023 00:42:27 +0900 Subject: [PATCH 3/3] Update src/uu/mknod/mknod.md Co-authored-by: Sylvestre Ledru --- src/uu/mknod/mknod.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/uu/mknod/mknod.md b/src/uu/mknod/mknod.md index 88034e76ada..78da970252e 100644 --- a/src/uu/mknod/mknod.md +++ b/src/uu/mknod/mknod.md @@ -11,14 +11,14 @@ Create the special file NAME of the given TYPE. Mandatory arguments to long options are mandatory for short options too. `-m`, `--mode=MODE` set file permission bits to `MODE`, not `a=rw - umask` -Both MAJOR and MINOR must be specified when TYPE is b, c, or u, and they -must be omitted when TYPE is p. If MAJOR or MINOR begins with 0x or 0X, +Both `MAJOR` and `MINOR` must be specified when `TYPE` is `b`, `c`, or `u`, and they +must be omitted when `TYPE` is `p`. If `MAJOR` or `MINOR` begins with `0x` or `0X`, it is interpreted as hexadecimal; otherwise, if it begins with 0, as octal; -otherwise, as decimal. TYPE may be: +otherwise, as decimal. `TYPE` may be: -b create a block (buffered) special file -c, u create a character (unbuffered) special file -p create a FIFO +* `b` create a block (buffered) special file +* `c`, `u` create a character (unbuffered) special file +* `p` create a FIFO NOTE: your shell may have its own version of mknod, which usually supersedes the version described here. Please refer to your shell's documentation