From c523aa43f2cddaae4146636f07330a7d34920101 Mon Sep 17 00:00:00 2001 From: Kartik Sharma Date: Sat, 19 Feb 2022 13:47:16 +0530 Subject: [PATCH] Fixes missing help on `expr` user docs. - Configured clap to take crate version, so version is now visible in docs. - Added ABOUT string from expr help output, so about section is getting rendered in docs. - Added USAGE section. - Added HELP section for each args. --- src/uu/expr/src/expr.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/uu/expr/src/expr.rs b/src/uu/expr/src/expr.rs index db0152dd7..188537fbc 100644 --- a/src/uu/expr/src/expr.rs +++ b/src/uu/expr/src/expr.rs @@ -14,12 +14,23 @@ mod tokens; const VERSION: &str = "version"; const HELP: &str = "help"; +static ABOUT: &str = "Print the value of EXPRESSION to standard output"; +static USAGE: &str = r#" + expr [EXPRESSION] + expr [OPTIONS]"#; pub fn uu_app<'a>() -> App<'a> { App::new(uucore::util_name()) + .version(crate_version!()) + .about(ABOUT) + .override_usage(USAGE) .setting(AppSettings::InferLongArgs) - .arg(Arg::new(VERSION).long(VERSION)) - .arg(Arg::new(HELP).long(HELP)) + .arg( + Arg::new(VERSION) + .long(VERSION) + .help("output version information and exit"), + ) + .arg(Arg::new(HELP).long(HELP).help("display this help and exit")) } #[uucore::main]