From 6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Mon, 17 Aug 2026 02:29:30 +0800 Subject: refactor!: remove dynamic dispatcher registration API Dispatchers are now always registered at compile time, removing the `with_dispatcher` / `with_dispatchers` methods and the `PathfinderConfig` API. The `dispatch_tree` feature now only controls the matching strategy (trie vs linear list). --- docs/pages/2-define-a-dispatcher.md | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'docs/pages/2-define-a-dispatcher.md') 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: -- cgit