diff options
Diffstat (limited to 'examples/example-command-macro/src/main.rs')
| -rw-r--r-- | examples/example-command-macro/src/main.rs | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/examples/example-command-macro/src/main.rs b/examples/example-command-macro/src/main.rs index e525098..6740518 100644 --- a/examples/example-command-macro/src/main.rs +++ b/examples/example-command-macro/src/main.rs @@ -22,27 +22,30 @@ fn main() { ThisProgram::new().exec_and_exit(); } -pack!(ResultGreeting = String); -pack!(ResultGoodbye = ()); +#[derive(Grouped, Wrap)] +pub struct ResultGreeting(String); + +#[derive(Grouped)] +pub struct ResultGoodbye; // --------- IMPORTANT --------- // Auto-generates dispatcher!("hello.world", EntryHelloWorld); #[command] fn hello_world() -> ResultGreeting { - ResultGreeting::new("World".to_string()) + ResultGreeting("World".to_string()) } // Auto-generates dispatcher!("hello-world", EntryGreetSomeone); #[command(node = "greet-someone")] fn greet_someone(args: Vec<String>) -> ResultGreeting { let name = args.pick_or(&arg![String], || "World".to_string()).unwrap(); - ResultGreeting::new(name) + ResultGreeting(name) } // Auto-generates dispatcher!("goodbye", EntryGoodBye); #[command(entry = EntryGoodBye)] fn goodbye() -> ResultGoodbye { - ResultGoodbye::default() + ResultGoodbye } // --------- IMPORTANT --------- |
