sleep: move help strings to markdown file

This commit is contained in:
Chen Chi 2023-02-21 15:56:52 -08:00
parent 6bd42fde6a
commit ddd40fda6b
2 changed files with 21 additions and 11 deletions

16
src/uu/sleep/sleep.md Normal file
View file

@ -0,0 +1,16 @@
# sleep
```
sleep NUMBER[SUFFIX]...
sleep OPTION
```
Pause for NUMBER seconds.
## After Help
Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number. Given two or more arguments, pause for the amount of time
specified by the sum of their values.

View file

@ -10,20 +10,14 @@ use std::time::Duration;
use uucore::{ use uucore::{
error::{UResult, USimpleError, UUsageError}, error::{UResult, USimpleError, UUsageError},
format_usage, show, format_usage, help_about, help_section, help_usage, show,
}; };
use clap::{crate_version, Arg, ArgAction, Command}; use clap::{crate_version, Arg, ArgAction, Command};
static ABOUT: &str = "Pause for NUMBER seconds."; static ABOUT: &str = help_about!("sleep.md");
const USAGE: &str = "\ const USAGE: &str = help_usage!("sleep.md");
{} NUMBER[SUFFIX]... static AFTER_HELP: &str = help_section!("after help", "sleep.md");
{} OPTION";
static LONG_HELP: &str = "Pause for NUMBER seconds. SUFFIX may be 's' for seconds (the default),
'm' for minutes, 'h' for hours or 'd' for days. Unlike most implementations
that require NUMBER be an integer, here NUMBER may be an arbitrary floating
point number. Given two or more arguments, pause for the amount of time
specified by the sum of their values.";
mod options { mod options {
pub const NUMBER: &str = "NUMBER"; pub const NUMBER: &str = "NUMBER";
@ -54,7 +48,7 @@ pub fn uu_app() -> Command {
Command::new(uucore::util_name()) Command::new(uucore::util_name())
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.after_help(LONG_HELP) .after_help(AFTER_HELP)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.infer_long_args(true) .infer_long_args(true)
.arg( .arg(