From 52902f6e99b978468fca7dcc9aff2414ca2f8d1f Mon Sep 17 00:00:00 2001 From: Koki Ueha Date: Wed, 22 Feb 2023 10:41:49 +0000 Subject: [PATCH] nohup: move help strings to markdown file --- src/uu/nohup/nohup.md | 15 +++++++++++++++ src/uu/nohup/src/nohup.rs | 17 +++++------------ 2 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 src/uu/nohup/nohup.md diff --git a/src/uu/nohup/nohup.md b/src/uu/nohup/nohup.md new file mode 100644 index 000000000..cc35ef9f4 --- /dev/null +++ b/src/uu/nohup/nohup.md @@ -0,0 +1,15 @@ +# nohup + +``` +nohup COMMAND [ARG]... +nohup FLAG +``` + +Run COMMAND ignoring hangup signals. + +## After Help + +If standard input is terminal, it'll be replaced with /dev/null. +If standard output is terminal, it'll be appended to nohup.out instead, +or $HOME/nohup.out, if nohup.out open failed. +If standard error is terminal, it'll be redirected to stdout. diff --git a/src/uu/nohup/src/nohup.rs b/src/uu/nohup/src/nohup.rs index d00ef4931..8247cdb3e 100644 --- a/src/uu/nohup/src/nohup.rs +++ b/src/uu/nohup/src/nohup.rs @@ -20,18 +20,11 @@ use std::os::unix::prelude::*; use std::path::{Path, PathBuf}; use uucore::display::Quotable; use uucore::error::{set_exit_code, UClapError, UError, UResult}; -use uucore::{format_usage, show_error}; +use uucore::{format_usage, help_about, help_section, help_usage, show_error}; -static ABOUT: &str = "Run COMMAND ignoring hangup signals."; -static LONG_HELP: &str = " -If standard input is terminal, it'll be replaced with /dev/null. -If standard output is terminal, it'll be appended to nohup.out instead, -or $HOME/nohup.out, if nohup.out open failed. -If standard error is terminal, it'll be redirected to stdout. -"; -const USAGE: &str = "\ - {} COMMAND [ARG]... - {} FLAG"; +const ABOUT: &str = help_about!("nohup.md"); +const AFTER_HELP: &str = help_section!("after help", "nohup.md"); +const USAGE: &str = help_usage!("nohup.md"); static NOHUP_OUT: &str = "nohup.out"; // exit codes that match the GNU implementation static EXIT_CANCELED: i32 = 125; @@ -116,7 +109,7 @@ pub fn uu_app() -> Command { Command::new(uucore::util_name()) .version(crate_version!()) .about(ABOUT) - .after_help(LONG_HELP) + .after_help(AFTER_HELP) .override_usage(format_usage(USAGE)) .arg( Arg::new(options::CMD)