From 896314a64e20ebb742ee79193b6b5793a15cf115 Mon Sep 17 00:00:00 2001 From: Piotr Kwiecinski Date: Thu, 23 Mar 2023 14:52:33 +0100 Subject: [PATCH] nice: move help strings to markdown file --- src/uu/nice/nice.md | 10 ++++++++++ src/uu/nice/src/nice.rs | 10 +++------- 2 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 src/uu/nice/nice.md diff --git a/src/uu/nice/nice.md b/src/uu/nice/nice.md new file mode 100644 index 000000000..872c239ca --- /dev/null +++ b/src/uu/nice/nice.md @@ -0,0 +1,10 @@ +# nice + +``` +nice [OPTIONS] [COMMAND [ARGS]] +``` + +Run `COMMAND` with an adjusted niceness, which affects process scheduling. +With no `COMMAND`, print the current niceness. Niceness values range from at +least -20 (most favorable to the process) to 19 (least favorable to the +process). diff --git a/src/uu/nice/src/nice.rs b/src/uu/nice/src/nice.rs index a059e13b7..b23608ff6 100644 --- a/src/uu/nice/src/nice.rs +++ b/src/uu/nice/src/nice.rs @@ -15,7 +15,7 @@ use std::ptr; use clap::{crate_version, Arg, ArgAction, Command}; use uucore::{ error::{set_exit_code, UClapError, UResult, USimpleError, UUsageError}, - format_usage, show_error, + format_usage, help_about, help_usage, show_error, }; pub mod options { @@ -23,12 +23,8 @@ pub mod options { pub static COMMAND: &str = "COMMAND"; } -const ABOUT: &str = "\ - Run COMMAND with an adjusted niceness, which affects process scheduling. \ - With no COMMAND, print the current niceness. Niceness values range from at \ - least -20 (most favorable to the process) to 19 (least favorable to the \ - process)."; -const USAGE: &str = "{} [OPTIONS] [COMMAND [ARGS]]"; +const ABOUT: &str = help_about!("nice.md"); +const USAGE: &str = help_usage!("nice.md"); fn is_prefix_of(maybe_prefix: &str, target: &str, min_match: usize) -> bool { if maybe_prefix.len() < min_match || maybe_prefix.len() > target.len() {