diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-17 02:29:30 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-17 02:39:56 +0800 |
| commit | 6980fbf2f9fb4c599d8dc6ff549a8b3288eb24e9 (patch) | |
| tree | bc7049698955d7a40706ea691fd5bab526a6b5e5 /examples/example-completion | |
| parent | 4c191b2b46a67a0dda6e9a867b40f45156af4f9c (diff) | |
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).
Diffstat (limited to 'examples/example-completion')
| -rw-r--r-- | examples/example-completion/src/main.rs | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/examples/example-completion/src/main.rs b/examples/example-completion/src/main.rs index d65be49..29d6026 100644 --- a/examples/example-completion/src/main.rs +++ b/examples/example-completion/src/main.rs @@ -44,19 +44,11 @@ //! Hello, Alice, Alice, Alice! //! ``` -use mingling::{macros::suggest, prelude::*, ShellContext, Suggest}; +use mingling::{ShellContext, Suggest, macros::suggest, prelude::*}; use std::io::Write; fn main() { - let mut program = ThisProgram::new(); - - program.with_dispatcher(CMDGreet); - - // --------- IMPORTANT --------- - // The `comp` feature makes `gen_program!()` generate a CMDCompletion automatically - // It adds a hidden `__comp` subcommand for communication with the completion script - program.with_dispatcher(crate::CMDCompletion); - // --------- IMPORTANT --------- + let program = ThisProgram::new(); // TIP: Note that the completion script reads stdout, // so make sure no output is produced before the CMDCompletion is dispatched. |
