diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-22 20:47:00 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-22 20:47:00 +0800 |
| commit | 31b5abfc96013309530025b751293c7de916dcf3 (patch) | |
| tree | ea151429c4d754e1d2b709e976ba369c534c226b /mingling/src | |
| parent | 5169b9a462a7a3854b8320c8d9e78985a34c5f15 (diff) | |
Add help command with exit code 2 for exitcode example
Diffstat (limited to 'mingling/src')
| -rw-r--r-- | mingling/src/example_docs.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs index 5ea04b1..f77d9f6 100644 --- a/mingling/src/example_docs.rs +++ b/mingling/src/example_docs.rs @@ -1108,10 +1108,16 @@ pub mod example_error_handling {} /// /// Source code (./src/main.rs) /// ```ignore -/// use mingling::{prelude::*, res::ResExitCode, setup::ExitCodeSetup}; +/// use mingling::{ +/// macros::help, +/// prelude::*, +/// res::ResExitCode, +/// setup::{BasicProgramSetup, ExitCodeSetup}, +/// }; /// /// fn main() { /// let mut program = ThisProgram::new(); +/// program.with_setup(BasicProgramSetup); /// /// // --------- IMPORTANT --------- /// // Register `ExitCodeSetup` for the program to enable exit codes @@ -1144,6 +1150,12 @@ pub mod example_error_handling {} /// r_println!("Hello, {}", *name); /// } /// +/// #[help] +/// fn help_hello(_p: EntryHello, ec: &mut ResExitCode) { +/// r_println!("Usage: hello <NAME>"); +/// ec.exit_code = 2; +/// } +/// /// // Define renderer, render error message _______________ Inject exit code resource /// // / /// /// Renders the error when no name is provided | |
