From 4bed10a26aa01bb5f2fa33ad4f815137d1aa274b Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Tue, 21 Mar 2023 13:46:00 +0800 Subject: [PATCH] hashsum: move help strings to markdown file --- src/uu/hashsum/hashsum.md | 7 +++++++ src/uu/hashsum/src/hashsum.rs | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 src/uu/hashsum/hashsum.md diff --git a/src/uu/hashsum/hashsum.md b/src/uu/hashsum/hashsum.md new file mode 100644 index 000000000..a632eedf3 --- /dev/null +++ b/src/uu/hashsum/hashsum.md @@ -0,0 +1,7 @@ +# hashsum + +``` +hashsum [OPTIONS] [FILE]... +``` + +Compute and check message digests. diff --git a/src/uu/hashsum/src/hashsum.rs b/src/uu/hashsum/src/hashsum.rs index c49c530e4..2835fce5a 100644 --- a/src/uu/hashsum/src/hashsum.rs +++ b/src/uu/hashsum/src/hashsum.rs @@ -24,6 +24,9 @@ use std::iter; use std::num::ParseIntError; use std::path::Path; use uucore::error::{FromIo, UError, UResult}; +use uucore::format_usage; +use uucore::help_about; +use uucore::help_usage; use uucore::sum::{ Blake2b, Blake3, Digest, DigestWriter, Md5, Sha1, Sha224, Sha256, Sha384, Sha3_224, Sha3_256, Sha3_384, Sha3_512, Sha512, Shake128, Shake256, @@ -31,6 +34,8 @@ use uucore::sum::{ use uucore::{crash, display::Quotable, show_warning}; const NAME: &str = "hashsum"; +const ABOUT: &str = help_about!("hashsum.md"); +const USAGE: &str = help_usage!("hashsum.md"); struct Options { algoname: &'static str, @@ -298,7 +303,8 @@ pub fn uu_app_common() -> Command { const TEXT_HELP: &str = "read in text mode (default)"; Command::new(uucore::util_name()) .version(crate_version!()) - .about("Compute and check message digests.") + .about(ABOUT) + .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( Arg::new("binary")