From f623a7e13aa215912dc8278b026ad1fc8355beb9 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Thu, 16 Mar 2023 17:57:00 +0800 Subject: [PATCH] whoami: move help strings to markdown file --- src/uu/whoami/src/whoami.rs | 5 ++++- src/uu/whoami/whoami.md | 7 +++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/uu/whoami/whoami.md diff --git a/src/uu/whoami/src/whoami.rs b/src/uu/whoami/src/whoami.rs index 18c61e28e..04360fe7a 100644 --- a/src/uu/whoami/src/whoami.rs +++ b/src/uu/whoami/src/whoami.rs @@ -11,10 +11,12 @@ use clap::{crate_version, Command}; use uucore::display::println_verbatim; use uucore::error::{FromIo, UResult}; +use uucore::{format_usage, help_about, help_usage}; mod platform; -static ABOUT: &str = "Print the current username."; +const ABOUT: &str = help_about!("whoami.md"); +const USAGE: &str = help_usage!("whoami.md"); #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { @@ -28,5 +30,6 @@ pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) + .override_usage(format_usage(USAGE)) .infer_long_args(true) } diff --git a/src/uu/whoami/whoami.md b/src/uu/whoami/whoami.md new file mode 100644 index 000000000..6106d24ee --- /dev/null +++ b/src/uu/whoami/whoami.md @@ -0,0 +1,7 @@ +# whoami + +``` +whoami +``` + +Print the current username.