From 31b5abfc96013309530025b751293c7de916dcf3 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 22 Jun 2026 20:47:00 +0800 Subject: Add help command with exit code 2 for exitcode example --- mingling/src/example_docs.rs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'mingling/src') 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 "); +/// ec.exit_code = 2; +/// } +/// /// // Define renderer, render error message _______________ Inject exit code resource /// // / /// /// Renders the error when no name is provided | -- cgit