diff options
Diffstat (limited to 'docs/pages')
| -rw-r--r-- | docs/pages/10-help.md | 1 | ||||
| -rw-r--r-- | docs/pages/13-hook.md | 1 | ||||
| -rw-r--r-- | docs/pages/2-define-a-dispatcher.md | 17 | ||||
| -rw-r--r-- | docs/pages/3-define-a-chain.md | 1 | ||||
| -rw-r--r-- | docs/pages/4-render-result.md | 1 | ||||
| -rw-r--r-- | docs/pages/5-multiple-commands.md | 2 | ||||
| -rw-r--r-- | docs/pages/7-argument-parse-clap.md | 1 | ||||
| -rw-r--r-- | docs/pages/9-error-handling.md | 1 | ||||
| -rw-r--r-- | docs/pages/advanced/1-completion.md | 2 | ||||
| -rw-r--r-- | docs/pages/advanced/2-structural-renderer.md | 1 |
10 files changed, 0 insertions, 28 deletions
diff --git a/docs/pages/10-help.md b/docs/pages/10-help.md index d9cc557..3d4b3b8 100644 --- a/docs/pages/10-help.md +++ b/docs/pages/10-help.md @@ -55,7 +55,6 @@ For `--help` to work properly, add `BasicProgramSetup` in `main`: fn main() { let mut program = ThisProgram::new(); program.with_setup(BasicProgramSetup); - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } ``` diff --git a/docs/pages/13-hook.md b/docs/pages/13-hook.md index d927a9c..c525998 100644 --- a/docs/pages/13-hook.md +++ b/docs/pages/13-hook.md @@ -75,7 +75,6 @@ fn main() { }), ); - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } ``` diff --git a/docs/pages/2-define-a-dispatcher.md b/docs/pages/2-define-a-dispatcher.md index 1208e64..432d7db 100644 --- a/docs/pages/2-define-a-dispatcher.md +++ b/docs/pages/2-define-a-dispatcher.md @@ -31,23 +31,6 @@ dispatcher!("greet", CMDGreet => EntryGreet); > [!NOTE] > The command name (`"greet"`) is auto-converted to kebab-case. Even if you write `"GreetUser"`, matching will use `greet-user`. -## Registering with Program - -Once you have a dispatcher, you need to tell Program about it: - -```rust -@@@ dispatcher!("greet", CMDGreet => EntryGreet); -@@@ fn main() { -@@@ let mut program = ThisProgram::new(); -// Register the dispatcher -program.with_dispatcher(CMDGreet); -@@@ } -@@@ gen_program!(); -``` - -> [!TIP] -> If you have many commands, use `with_dispatchers` to register multiple at once: `program.with_dispatchers((CMDGreet, CMDAdd, CMDRemoteRm))`. - ## Multi-level Commands If your program has a hierarchy — e.g., `remote add`, `remote rm` — just separate the command name with dots: diff --git a/docs/pages/3-define-a-chain.md b/docs/pages/3-define-a-chain.md index 450522b..1134dbf 100644 --- a/docs/pages/3-define-a-chain.md +++ b/docs/pages/3-define-a-chain.md @@ -117,7 +117,6 @@ fn handle_greet(args: EntryGreet) -> Next { fn main() { let mut program = ThisProgram::new(); - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } diff --git a/docs/pages/4-render-result.md b/docs/pages/4-render-result.md index 7b63b45..a50c509 100644 --- a/docs/pages/4-render-result.md +++ b/docs/pages/4-render-result.md @@ -76,7 +76,6 @@ fn render_name(name: ResultName) { // 5. Assemble and run the program in main fn main() { let mut program = ThisProgram::new(); - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } diff --git a/docs/pages/5-multiple-commands.md b/docs/pages/5-multiple-commands.md index 17739e3..b92cb95 100644 --- a/docs/pages/5-multiple-commands.md +++ b/docs/pages/5-multiple-commands.md @@ -42,8 +42,6 @@ fn render_sum(result: ResultSum) { fn main() { let mut program = ThisProgram::new(); - program.with_dispatcher(CMDGreet); - program.with_dispatcher(CMDAdd); program.exec_and_exit(); } diff --git a/docs/pages/7-argument-parse-clap.md b/docs/pages/7-argument-parse-clap.md index 3b8ec8b..ee1e96f 100644 --- a/docs/pages/7-argument-parse-clap.md +++ b/docs/pages/7-argument-parse-clap.md @@ -76,7 +76,6 @@ fn main() { program.with_setup(BasicProgramSetup); program.stdout_setting.clap_help_print_behaviour = mingling::config::ClapHelpPrintBehaviour::WriteToRenderResult; - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } ``` diff --git a/docs/pages/9-error-handling.md b/docs/pages/9-error-handling.md index 680328c..389e394 100644 --- a/docs/pages/9-error-handling.md +++ b/docs/pages/9-error-handling.md @@ -88,7 +88,6 @@ fn render_error_name_empty(err: ErrorNameEmpty) { fn main() { let mut program = ThisProgram::new(); - program.with_dispatcher(CMDGreet); program.exec_and_exit(); } diff --git a/docs/pages/advanced/1-completion.md b/docs/pages/advanced/1-completion.md index 52350db..f70d415 100644 --- a/docs/pages/advanced/1-completion.md +++ b/docs/pages/advanced/1-completion.md @@ -24,8 +24,6 @@ features = [ When the user presses `TAB`, the completion script calls the program's hidden subcommand `__comp`, which dynamically queries the best suggestions based on the provided `ShellContext`. -This hidden subcommand is auto-generated by `gen_program!()` when the `comp` feature is enabled. Its dispatcher is `CMDCompletion` — you need to add it to your program via `with_dispatcher`. - Completion flow: 1. Re-match the user's current input to a `Dispatcher` diff --git a/docs/pages/advanced/2-structural-renderer.md b/docs/pages/advanced/2-structural-renderer.md index b54af22..489baba 100644 --- a/docs/pages/advanced/2-structural-renderer.md +++ b/docs/pages/advanced/2-structural-renderer.md @@ -95,7 +95,6 @@ fn render_info(info: Info) { @@@fn main() { @@@ let mut program = ThisProgram::new(); @@@ program.with_setup(StructuralRendererSetup); -@@@ program.with_dispatcher(CMDRender); @@@ program.exec(); @@@} @@@gen_program!(); |
