From 811ffc3ed7b895b9885754b5022c782c934a0ddb Mon Sep 17 00:00:00 2001 From: Avril Date: Thu, 24 Dec 2020 16:09:48 +0000 Subject: [PATCH] usage: added env section --- src/arg/usage.rs | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/arg/usage.rs b/src/arg/usage.rs index 5f3f909..a4a9b46 100644 --- a/src/arg/usage.rs +++ b/src/arg/usage.rs @@ -158,6 +158,7 @@ impl fmt::Display for Opt opt!("--unlimit", "-U"; * 3 "No limit to number of processes spawned at once"), opt!("--completion", "-c" => "action"; "Set the default action on completion", ["ACTIONS", "COMPLETION"], "ignore"), opt!("--silent", "-s"; * 3 "Output no messages other than that of child processes"), + opt!("--stfu", "-S"; * 3 "Output no messages at all"), opt!("\nChild I/O"), opt!(where "Defaults for I/O redirections of children\nThese can be overwritten individually with explicit inputs."), @@ -198,13 +199,14 @@ impl fmt::Display for Opt ] } +/// The `process completion` section. #[inline] fn completion() -> impl Iterator { iter![ opt!(in "COMPLETION"), opt!(where "Directives for how to handle abnormal process completion (i.e. non-zero exit codes)\nThis does not apply to `detached` processes", ["DETACHING"]), - opt!("ignore"; * 2 "Ignore process return code"), + opt!("ignore"; * 2 "Ignore process return code", ""), opt!("supercede"; * 2 "If return code is a non-zero code, use it as the return code for the parent (this) process.\n\t\t\tIf there are multiple non-zero return codes, it is not specified which is returned"), opt!("terminate"; * 2 "If return code is a non-zero code, abort all running children and return the code as this process' return code immediately"), opt!("wait"; * 3 "Same as `terminate`, except waits for currently active processes to complete before aborting"), @@ -216,10 +218,31 @@ impl fmt::Display for Opt ] } -/// Get the sections as display iterators +#[inline] fn environment() -> impl Iterator +{ + iter![ + opt!(in "ENVIRONMENT"), + opt!(where "Some environment variables can control the behaviour of the program also"), + + opt!("RUST_LOG"), + opt!(where "Controls the logging level of the parent process\nThese can be surpressed entirely by `--silent` or `--stfu`\nIf the var is not set, the default level is used."), + opt!("trace"; * 2 "The most verbose logging"), + opt!("debug"; * 2 "Include debug messages"), + opt!("info"; * 2 "Include information messages"), + opt!("warn"; * 2 "Only warnings and errors"), + opt!("error"; * 2 "Only errors"), + opt!("none"; * 2 "No diagnostic messages", ""), + + opt!() + ] +} + +/// Get the sections as display iterators. +/// Each item in the iterator is intended to be written as a single line. pub fn sections() -> impl Iterator { options() .chain(actions()) .chain(completion()) + .chain(environment()) }