From 61ad84f4478ca75f6007c58574f82a8b9e12f4b7 Mon Sep 17 00:00:00 2001 From: ValentinyFilip <80767029+ValentinyFilip@users.noreply.github.com> Date: Wed, 15 Mar 2023 19:09:38 +0100 Subject: [PATCH] cksum: move help strings to markdown file --- src/uu/cksum/cksum.md | 23 +++++++++++++++++++++++ src/uu/cksum/src/cksum.rs | 25 +++++++------------------ 2 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 src/uu/cksum/cksum.md diff --git a/src/uu/cksum/cksum.md b/src/uu/cksum/cksum.md new file mode 100644 index 000000000..b613d4d43 --- /dev/null +++ b/src/uu/cksum/cksum.md @@ -0,0 +1,23 @@ +# cksum + +``` +cksum [OPTIONS] [FILE]... +``` + +Print CRC and size for each file + +## After Help + +DIGEST determines the digest algorithm and default output format: + +-a=sysv: (equivalent to sum -s) +-a=bsd: (equivalent to sum -r) +-a=crc: (equivalent to cksum) +-a=md5: (equivalent to md5sum) +-a=sha1: (equivalent to sha1sum) +-a=sha224: (equivalent to sha224sum) +-a=sha256: (equivalent to sha256sum) +-a=sha384: (equivalent to sha384sum) +-a=sha512: (equivalent to sha512sum) +-a=blake2b: (equivalent to b2sum) +-a=sm3: (only available through cksum) diff --git a/src/uu/cksum/src/cksum.rs b/src/uu/cksum/src/cksum.rs index e66d5f029..6cde7f6c1 100644 --- a/src/uu/cksum/src/cksum.rs +++ b/src/uu/cksum/src/cksum.rs @@ -20,10 +20,14 @@ use uucore::{ div_ceil, Blake2b, Digest, DigestWriter, Md5, Sha1, Sha224, Sha256, Sha384, Sha512, Sm3, BSD, CRC, SYSV, }, + help_about, + help_usage, + help_section, }; -const USAGE: &str = "{} [OPTIONS] [FILE]..."; -const ABOUT: &str = "Print CRC and size for each file"; +const USAGE: &str = help_usage!("cksum.md"); +const ABOUT: &str = help_about!("cksum.md"); +const AFTER_HELP: &str = help_section!("after help", "cksum.md"); const ALGORITHM_OPTIONS_SYSV: &str = "sysv"; const ALGORITHM_OPTIONS_BSD: &str = "bsd"; @@ -205,21 +209,6 @@ mod options { pub static ALGORITHM: &str = "algorithm"; } -const ALGORITHM_HELP_DESC: &str = - "DIGEST determines the digest algorithm and default output format:\n\ -\n\ --a=sysv: (equivalent to sum -s)\n\ --a=bsd: (equivalent to sum -r)\n\ --a=crc: (equivalent to cksum)\n\ --a=md5: (equivalent to md5sum)\n\ --a=sha1: (equivalent to sha1sum)\n\ --a=sha224: (equivalent to sha224sum)\n\ --a=sha256: (equivalent to sha256sum)\n\ --a=sha384: (equivalent to sha384sum)\n\ --a=sha512: (equivalent to sha512sum)\n\ --a=blake2b: (equivalent to b2sum)\n\ --a=sm3: (only available through cksum)\n"; - #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let args = args.collect_ignore(); @@ -278,5 +267,5 @@ pub fn uu_app() -> Command { ALGORITHM_OPTIONS_SM3, ]), ) - .after_help(ALGORITHM_HELP_DESC) + .after_help(AFTER_HELP) }