From e82ba6e7073fa1ff0cd3c42005cb4cecf70f075b Mon Sep 17 00:00:00 2001 From: m11o Date: Sat, 22 Apr 2023 16:10:26 +0900 Subject: [PATCH 1/3] readlink: move help strings to markdown file --- src/uu/readlink/readlink.md | 7 +++++++ src/uu/readlink/src/readlink.rs | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 src/uu/readlink/readlink.md diff --git a/src/uu/readlink/readlink.md b/src/uu/readlink/readlink.md new file mode 100644 index 00000000000..7215acbec09 --- /dev/null +++ b/src/uu/readlink/readlink.md @@ -0,0 +1,7 @@ +# readlink + +``` +readlink [OPTION]... [FILE]... +``` + +Print value of a symbolic link or canonical file name. diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 8afb184be98..807f515d406 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -14,10 +14,10 @@ use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; use uucore::fs::{canonicalize, MissingHandling, ResolveMode}; -use uucore::{format_usage, show_error}; +use uucore::{format_usage, show_error, help_about, help_usage}; -const ABOUT: &str = "Print value of a symbolic link or canonical file name."; -const USAGE: &str = "{} [OPTION]... [FILE]..."; +const ABOUT: &str = help_about!("readlink.md"); +const USAGE: &str = help_usage!("readlink.md"); const OPT_CANONICALIZE: &str = "canonicalize"; const OPT_CANONICALIZE_MISSING: &str = "canonicalize-missing"; const OPT_CANONICALIZE_EXISTING: &str = "canonicalize-existing"; From b84a94b8895137819f5eda95db74dc16febba69c Mon Sep 17 00:00:00 2001 From: m11o Date: Sat, 22 Apr 2023 16:11:36 +0900 Subject: [PATCH 2/3] refactor: use override_help instead of override_usage --- src/uu/readlink/src/readlink.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 807f515d406..0d6e9fc1b1b 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -99,7 +99,7 @@ pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) - .override_help(format_usage(USAGE)) + .override_usage(format_usage(USAGE)) .infer_long_args(true) .arg( Arg::new(OPT_CANONICALIZE) From 31c1d9c956dac70f3b8ffe4a58d3426e9cf50678 Mon Sep 17 00:00:00 2001 From: m11o Date: Sat, 22 Apr 2023 16:33:58 +0900 Subject: [PATCH 3/3] fix format --- src/uu/readlink/src/readlink.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/uu/readlink/src/readlink.rs b/src/uu/readlink/src/readlink.rs index 0d6e9fc1b1b..e247c614695 100644 --- a/src/uu/readlink/src/readlink.rs +++ b/src/uu/readlink/src/readlink.rs @@ -14,7 +14,7 @@ use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{FromIo, UResult, USimpleError, UUsageError}; use uucore::fs::{canonicalize, MissingHandling, ResolveMode}; -use uucore::{format_usage, show_error, help_about, help_usage}; +use uucore::{format_usage, help_about, help_usage, show_error}; const ABOUT: &str = help_about!("readlink.md"); const USAGE: &str = help_usage!("readlink.md");