From 1db97834ecc7fa50ce642496c8396e3bd8649c6e Mon Sep 17 00:00:00 2001 From: wuseyu <1599546654@qq.com> Date: Tue, 7 Mar 2023 11:05:09 +0800 Subject: [PATCH 1/2] env: move help strings to a markdown file --- src/uu/env/env.md | 13 +++++++++++++ src/uu/env/src/env.rs | 10 ++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 src/uu/env/env.md diff --git a/src/uu/env/env.md b/src/uu/env/env.md new file mode 100644 index 000000000..d62b4bb16 --- /dev/null +++ b/src/uu/env/env.md @@ -0,0 +1,13 @@ +# env + +``` +{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...] +``` + + +Set each NAME to VALUE in the environment and run COMMAND + + +## After Help + +A mere - implies -i. If no COMMAND, print the resulting environment. diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index b3fa871d3..8129b590a 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -23,13 +23,11 @@ use std::os::unix::process::ExitStatusExt; use std::process; use uucore::display::Quotable; use uucore::error::{UClapError, UResult, USimpleError, UUsageError}; -use uucore::{format_usage, show_warning}; +use uucore::{format_usage, show_warning, help_about, help_section, help_usage}; -const ABOUT: &str = "Set each NAME to VALUE in the environment and run COMMAND"; -const USAGE: &str = "{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]"; -const AFTER_HELP: &str = "\ -A mere - implies -i. If no COMMAND, print the resulting environment. -"; +const ABOUT: &str = help_about!("env.md"); +const USAGE: &str = help_usage!("env.md"); +const AFTER_HELP: &str = help_section!("after help", "env.md"); struct Options<'a> { ignore_env: bool, From 3d4cea1105bbfd347de62d1670f0010eff50851a Mon Sep 17 00:00:00 2001 From: wuseyu <1599546654@qq.com> Date: Tue, 7 Mar 2023 17:20:35 +0800 Subject: [PATCH 2/2] env: fix some format error --- src/uu/env/env.md | 2 +- src/uu/env/src/env.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/env/env.md b/src/uu/env/env.md index d62b4bb16..fc3341a61 100644 --- a/src/uu/env/env.md +++ b/src/uu/env/env.md @@ -1,7 +1,7 @@ # env ``` -{} [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...] +env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...] ``` diff --git a/src/uu/env/src/env.rs b/src/uu/env/src/env.rs index 8129b590a..a29ee3b0f 100644 --- a/src/uu/env/src/env.rs +++ b/src/uu/env/src/env.rs @@ -23,7 +23,7 @@ use std::os::unix::process::ExitStatusExt; use std::process; use uucore::display::Quotable; use uucore::error::{UClapError, UResult, USimpleError, UUsageError}; -use uucore::{format_usage, show_warning, help_about, help_section, help_usage}; +use uucore::{format_usage, help_about, help_section, help_usage, show_warning}; const ABOUT: &str = help_about!("env.md"); const USAGE: &str = help_usage!("env.md");