From c23c590330af83afb6e146bcd9b0a274b3689d22 Mon Sep 17 00:00:00 2001
From: 魏曹先生 <1992414357@qq.com>
Date: Mon, 17 Aug 2026 03:27:46 +0800
Subject: refactor!: remove Node type and simplify dispatcher macro syntax
The `dispatcher!` macro no longer requires a `CMD*` dispatcher type
argument; the dispatcher struct is now generated internally as
`__Dispatcher{Pascal}`. The `Node` type, `node!` macro, and
`Dispatcher::node()` / `clone_dispatcher()` methods are removed.
---
.config/verified-docs.toml | 2 +-
CHANGELOG.md | 64 +++++++++
GETTING-STARTED.md | 67 ++++-----
README.md | 4 +-
docs/_zh_CN/pages/10-help.md | 4 +-
docs/_zh_CN/pages/11-resource-system.md | 6 +-
docs/_zh_CN/pages/13-hook.md | 2 +-
docs/_zh_CN/pages/14-testing.md | 6 +-
docs/_zh_CN/pages/2-define-a-dispatcher.md | 10 +-
docs/_zh_CN/pages/3-define-a-chain.md | 8 +-
docs/_zh_CN/pages/4-render-result.md | 2 +-
docs/_zh_CN/pages/5-multiple-commands.md | 8 +-
docs/_zh_CN/pages/6-argument-parse-picker.md | 24 ++--
docs/_zh_CN/pages/7-argument-parse-clap.md | 4 +-
docs/_zh_CN/pages/9-error-handling.md | 6 +-
docs/_zh_CN/pages/advanced/1-completion.md | 2 +-
.../_zh_CN/pages/advanced/2-structural-renderer.md | 4 +-
docs/_zh_CN/pages/other/features.md | 16 +--
docs/_zh_CN/pages/other/naming_rule.md | 28 ++--
docs/pages/10-help.md | 4 +-
docs/pages/11-resource-system.md | 6 +-
docs/pages/13-hook.md | 2 +-
docs/pages/14-testing.md | 6 +-
docs/pages/2-define-a-dispatcher.md | 10 +-
docs/pages/3-define-a-chain.md | 8 +-
docs/pages/4-render-result.md | 2 +-
docs/pages/5-multiple-commands.md | 8 +-
docs/pages/6-argument-parse-picker.md | 24 ++--
docs/pages/7-argument-parse-clap.md | 4 +-
docs/pages/9-error-handling.md | 6 +-
docs/pages/advanced/1-completion.md | 2 +-
docs/pages/advanced/2-structural-renderer.md | 4 +-
docs/pages/other/features.md | 2 +-
docs/pages/other/naming_rule.md | 28 ++--
docs/res/changlog_examples/feat_program_res.rs | 2 +-
examples/example-argument-parse/src/main.rs | 4 +-
examples/example-argument-picker/src/main.rs | 2 +-
examples/example-async-support/src/main.rs | 2 +-
examples/example-basic/src/main.rs | 2 +-
examples/example-clap-binding/src/main.rs | 2 +-
.../example-combine-pathf-metadata/src/sub/mod.rs | 2 +-
examples/example-command-macro/src/main.rs | 8 +-
examples/example-completion/src/main.rs | 2 +-
examples/example-custom-pickable/src/main.rs | 2 +-
examples/example-dispatch-tree/src/main.rs | 28 ++--
examples/example-enum-tag/src/main.rs | 2 +-
examples/example-error-handling/src/main.rs | 2 +-
examples/example-exitcode/src/main.rs | 2 +-
examples/example-help/src/main.rs | 2 +-
examples/example-hook/src/main.rs | 2 +-
examples/example-implicit-dispatcher/src/main.rs | 7 +-
examples/example-lazy-resources/src/main.rs | 4 +-
examples/example-metadata/src/main.rs | 6 +-
examples/example-pack-err/src/main.rs | 4 +-
examples/example-panic-unwind/src/main.rs | 2 +-
examples/example-pathfinder/src/sub/mod.rs | 2 +-
examples/example-repl-basic/src/main.rs | 8 +-
examples/example-resources/src/main.rs | 4 +-
examples/example-setup/src/main.rs | 2 +-
examples/example-structural-renderer/src/main.rs | 2 +-
examples/example-unit-test/src/main.rs | 2 +-
mingling/src/docs/lib.md | 2 +-
mingling/src/example_docs.rs | 103 +++++++-------
mingling/src/gen_program.rs | 9 --
mingling/src/lib.rs | 1 -
mingling_cli/src/linter/cmd_lint.rs | 2 +-
mingling_cli/src/linter/cmd_ra_lints.rs | 6 +-
mingling_core/src/asset.rs | 1 -
mingling_core/src/asset/dispatcher.rs | 141 +-----------------
mingling_core/src/asset/node.rs | 157 ---------------------
mingling_core/src/lib.rs | 1 -
mingling_core/tests/test-all/tests/integration.rs | 15 --
.../tests/test-basic/tests/integration.rs | 28 ----
.../tests/test-dispatch-tree/tests/integration.rs | 28 ----
mingling_core/tests/test-repl/tests/integration.rs | 15 --
mingling_macros/src/attr/command.rs | 53 +++----
mingling_macros/src/attr/dispatcher_clap.rs | 39 +++--
mingling_macros/src/func.rs | 1 -
mingling_macros/src/func/dispatcher.rs | 123 ++++++++--------
mingling_macros/src/func/node.rs | 60 --------
mingling_macros/src/func/program_comp_gen.rs | 4 +-
mingling_macros/src/lib.rs | 49 +------
mingling_pathf/src/patterns/dispatcher.rs | 85 ++++-------
mingling_pathf/src/patterns/dispatcher_clap.rs | 56 ++++----
mingling_pathf/test/src/lib.rs | 69 +++++----
.../test/src/test_files/test_dispatcher.rs | 12 +-
.../test/src/test_files/test_dispatcher_clap.rs | 14 +-
.../test_files/test_dispatcher_dispatch_tree.rs | 8 +-
88 files changed, 548 insertions(+), 1026 deletions(-)
delete mode 100644 mingling_core/src/asset/node.rs
delete mode 100644 mingling_macros/src/func/node.rs
diff --git a/.config/verified-docs.toml b/.config/verified-docs.toml
index f3b1f85..df2469b 100644
--- a/.config/verified-docs.toml
+++ b/.config/verified-docs.toml
@@ -3,6 +3,6 @@
[verified]
readme = "./README.md"
-getting_started = "./GETTING_STARTED.md"
+getting_started = "./GETTING-STARTED.md"
documents_en_us = "./docs/pages/**"
documents_zh_cn = "./docs/_zh_CN/pages/**"
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e8ce5d2..7094c3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -138,6 +138,70 @@ None
_Behavioral note:_ the runtime behavior of programs is unchanged — all dispatchers registered via `with_dispatcher` are now simply gathered automatically, and the "longest registered prefix wins" matching rule is preserved by both the trie and the linear-list strategies.
+3. **[`core`]** **[`macros`]** **[BREAKING REMOVAL]** Removed the `Node` type, the `node!` macro, and the `Dispatcher::node()` / `Dispatcher::clone_dispatcher()` methods. Command path matching is now handled entirely by the compile-time-collected string command names, and dispatchers are identified by a hidden internally-generated `__Dispatcher*` struct.
+
+ ### What changed
+
+ The `Node` struct (in `mingling_core::asset::node`) was a path hierarchy of kebab-cased string segments used by the old dynamic dispatcher to match user input. With dispatchers now always collected at compile time (see **BREAKING CHANGE #2** above), the `Node` type and its supporting machinery became dead code. Command names are now stored and matched as plain string literals during compile-time registration.
+
+ **Removed API:**
+
+ - **`mingling_core::Node`** — Removed the entire `node` module and its public re-export. This includes the struct itself, its `From<&str>` / `From` impls, `join()`, `PartialEq` / `Eq`, `PartialOrd` / `Ord`, `Display`, and `Default`.
+ - **`mingling::macros::node!`** — Removed the `node!` procedural macro. It was only used internally by `dispatcher!` / `dispatcher_clap!` / `#[command]` to construct a `Node` from a dot-separated string; now that `Node` is gone, the macro is obsolete.
+ - **`Dispatcher::node(&self) -> Node`** — Removed from the `Dispatcher` trait. Dispatchers no longer expose a `Node` hierarchy; the command path is embedded in the compile-time registration via `register_dispatcher!("name", ...)`.
+ - **`Dispatcher::clone_dispatcher(&self) -> Box>`** — Removed from the `Dispatcher` trait, along with the blanket `Clone for Box>` impl (which relied on `clone_dispatcher`). Dynamic dispatch / boxing of dispatchers is no longer supported.
+ - **`mingling::macros::node` re-export** — Removed from `mingling_macros/src/lib.rs` and `mingling/src/lib.rs`.
+
+ **Dispatcher trait now requires only `begin`:**
+
+ ```rust
+ pub trait Dispatcher {
+ fn begin(&self, args: Vec) -> ChainProcess;
+ }
+ ```
+
+ **Generated dispatcher struct renamed:**
+
+ The `dispatcher!` / `dispatcher_clap!` / `#[command]` macros now generate a **hidden** dispatcher struct named `__Dispatcher{Pascal}` (e.g., `__DispatcherGreet`) instead of the user-facing `CMD*` struct. The struct is marked `#[doc(hidden)]` and `#[allow(nonstandard_style)]`. Users never reference it directly — it is registered at compile time via `register_dispatcher!` and matched purely by its string command name.
+
+ **`Dispatcher` trait example** (from `mingling_core/src/asset/dispatcher.rs` docs):
+
+ ```rust,ignore
+ impl Dispatcher for CMDGreet {
+ fn begin(&self, args: Vec) -> ChainProcess {
+ Routable::to_chain(Foo { args })
+ }
+ }
+ ```
+
+ **`dispatcher!` syntax change** (reflected in **BREAKING CHANGE #1**'s rename context):
+
+ - Old: `dispatcher!("greet", CMDGreet => EntryGreet)`
+ - New: `dispatcher!("greet", EntryGreet)`
+
+ The `CMD*` is no longer part of the user-facing syntax — the dispatcher struct is generated internally as `__Dispatcher*`. The old form produces a compile error with a migration hint.
+
+ **`dispatcher_clap!` syntax change:**
+
+ - Old: `#[dispatcher_clap("greet", CMDGreet, help = true, error = ErrorGreet)]`
+ - New: `#[dispatcher_clap("greet", help = true, error = ErrorGreet)]`
+
+ `#[dispatcher_clap("greet")]` (bare, no options) is still valid.
+
+ **`#[command]` syntax change:**
+
+ - The `name = CMDName` attribute argument was removed. `#[command(entry = EntryGreet)]` still works; the dispatcher struct is generated internally as `__DispatcherGreet`.
+
+ ### Migration guide
+ - **Replace all `dispatcher!("name", CMDType => EntryType)` calls** with `dispatcher!("name", EntryType)`. The `CMD*` identifier is no longer generated or referenced.
+ - **Replace all `#[dispatcher_clap("name", CMDType, ...)]` attributes** with `#[dispatcher_clap("name", ...)]` (drop the `CMDType` argument).
+ - **Remove `name = CMDName` from `#[command(...)]`** attributes. If you still reference the old generated `CMDName` type (e.g., in `program.with_dispatcher(...)`), remove that call entirely — dispatchers are auto-collected (see **BREAKING CHANGE #2**).
+ - **Remove any `use mingling::Node;` imports** and any code constructing / manipulating `Node` values. If you had custom `Dispatcher` implementations, they must (a) drop the `node()` and `clone_dispatcher()` methods and (b) rely on the compile-time registration (via `dispatcher!` / `dispatcher_clap!` / `#[command]`) rather than manual `with_dispatcher` dynamic dispatch.
+ - **Remove any `node!("...")` macro invocations.** The `node!` macro no longer exists.
+ - **Any manual `Dispatcher` impls** now only need `begin()`. If you previously implemented `node()` for a custom dispatcher used with `program.with_dispatcher(...)`, that whole registration model is removed — see **BREAKING CHANGE #2** for the compile-time-only registration approach.
+
+ _No behavioral changes to command matching — the semantics of dot-separated command paths, kebab-case normalization, and "longest registered prefix wins" are all preserved by the compiled-in string-based dispatch trie / linear list. The removal is purely an API simplification: the `Node` intermediate abstraction and the dispatcher-boxing machinery are gone._
+
---
## Contents
diff --git a/GETTING-STARTED.md b/GETTING-STARTED.md
index add49eb..c1b8e25 100644
--- a/GETTING-STARTED.md
+++ b/GETTING-STARTED.md
@@ -29,22 +29,21 @@ The entry point for every subcommand is the `dispatcher!` macro. It generates tw
```rust
use mingling::prelude::*;
-// command.name Dispatcher EntryType
-// │ │ │
-dispatcher!("greet", CMDGreet => EntryGreet);
+// command.name EntryType
+// │ │
+dispatcher!("greet", EntryGreet);
// Nested subcommand: `remote add`
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
+dispatcher!("remote.add", EntryRemoteAdd);
```
Then in `main()`, register the dispatcher with the program:
```rust
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(CMDGreet);
program.exec_and_exit();
}
```
@@ -65,7 +64,7 @@ dispatcher!("greet");
The `#[chain]` attribute turns a plain function into an execution step. Think of it as "the logic that transforms one typed value into another."
```rust
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
@@ -132,7 +131,7 @@ Mingling provides a **Picker** for argument extraction. You can use `pick()` or
```rust
// Features: ["picker"]
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
#[chain]
@@ -159,7 +158,7 @@ Enable it by adding `BasicProgramSetup`:
use mingling::{macros::help, prelude::*, setup::BasicProgramSetup};
use std::io::Write;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
#[help]
fn help_greet(_prev: EntryGreet) -> RenderResult {
@@ -172,7 +171,6 @@ fn help_greet(_prev: EntryGreet) -> RenderResult {
fn main() {
let mut program = ThisProgram::new();
program.with_setup(BasicProgramSetup); // enables --help / -h
- program.with_dispatcher(CMDGreet);
program.exec_and_exit();
}
@@ -196,7 +194,7 @@ With the `comp` feature, Mingling provides a fully dynamic completion system. Yo
use mingling::{macros::suggest, ShellContext, Suggest};
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultName = (u8, String));
#[completion(EntryGreet)]
@@ -230,7 +228,6 @@ You also need to register the built-in completion dispatcher:
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(crate::CMDCompletion);
program.exec_and_exit();
}
```
@@ -252,7 +249,7 @@ use mingling::{ShellContext, Suggest};
use mingling::macros::suggest_enum;
use mingling::EnumTag;
-dispatcher!("lang.select", CMDLang => EntryLang);
+dispatcher!("lang.select", EntryLang);
#[derive(EnumTag)]
pub enum ProgrammingLanguages {
@@ -278,7 +275,7 @@ use mingling::macros::pack;
use mingling::prelude::*;
use std::io::Write;
-dispatcher!("hello", CMDHello => EntryHello);
+dispatcher!("hello", EntryHello);
pack!(ResultName = String);
pack!(ErrorNoNameProvided = ());
pack!(ErrorNameTooLong = u16);
@@ -327,8 +324,8 @@ Chain and renderer functions can accept **additional parameters** for the progra
use std::path::PathBuf;
-dispatcher!("current", CMDCurrent => EntryCurrent);
-dispatcher!("cd", CMDCd => EntryCd);
+dispatcher!("current", EntryCurrent);
+dispatcher!("cd", EntryCd);
#[derive(Default, Clone)]
struct ResCurrentDir {
@@ -340,8 +337,6 @@ fn main() {
program.with_resource(ResCurrentDir {
current_dir: std::env::current_dir().unwrap(),
});
- program.with_dispatcher(CMDCurrent);
- program.with_dispatcher(CMDCd);
program.exec_and_exit();
}
@@ -367,7 +362,7 @@ Resources can also be injected into `#[renderer]`:
use mingling::prelude::*;
use std::io::Write;
-dispatcher!("current", CMDCurrent => EntryCurrent);
+dispatcher!("current", EntryCurrent);
#[derive(Default, Clone)]
struct ResCurrentDir {
@@ -391,11 +386,11 @@ As your program grows to dozens or hundreds of subcommands, linear dispatcher lo
```rust
// Features: ["dispatch_tree"]
-dispatcher!("cmd1", CMD1 => Entry1);
-dispatcher!("cmd2.sub1", CMD2Sub1 => Entry2Sub1);
-dispatcher!("cmd2.sub2", CMD2Sub2 => Entry2Sub2);
-dispatcher!("cmd3.sub1.leaf1", CMD3Sub1Leaf1 => Entry3Sub1Leaf1);
-dispatcher!("cmd3.sub1.leaf2", CMD3Sub1Leaf2 => Entry3Sub1Leaf2);
+dispatcher!("cmd1", Entry1);
+dispatcher!("cmd2.sub1", Entry2Sub1);
+dispatcher!("cmd2.sub2", Entry2Sub2);
+dispatcher!("cmd3.sub1.leaf1", Entry3Sub1Leaf1);
+dispatcher!("cmd3.sub1.leaf2", Entry3Sub1Leaf2);
// ... dozens more
fn main() {
@@ -429,7 +424,7 @@ use std::io::Write;
#[derive(Default, clap::Parser, Grouped)]
#[dispatcher_clap(
- "greet", CMDGreet,
+ "greet",
help = true, // auto-generate #[help] from clap
error = ErrorGreetParsed, // capture parse errors as a renderable type
)]
@@ -463,13 +458,12 @@ You can control how clap help is displayed:
```rust
// Features: ["clap"]
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(CMDGreet);
program.stdout_setting.clap_help_print_behaviour =
- mingling::ClapHelpPrintBehaviour::WriteToRenderResult;
+ mingling::config::ClapHelpPrintBehaviour::WriteToRenderResult;
// or: PrintDirectly — writes clap help straight to stdout
program.exec_and_exit();
}
@@ -499,14 +493,12 @@ use mingling::{
setup::{BasicREPLReadlineSetup, BasicREPLOutputSetup, BasicREPLPromptSetup},
};
-dispatcher!("cd", CMDCd => EntryCd);
-dispatcher!("exit", CMDExit => EntryExit);
+dispatcher!("cd", EntryCd);
+dispatcher!("exit", EntryExit);
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(CMDCd);
- program.with_dispatcher(CMDExit);
// Enable line reading from stdin
program.with_setup(BasicREPLReadlineSetup);
@@ -538,7 +530,7 @@ use mingling::{
hook::{ProgramControlUnit, ProgramHook},
};
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
@@ -560,7 +552,6 @@ fn main() {
.on_post_render(|_| println!("[DEBUG] Post render")),
);
- program.with_dispatcher(CMDGreet);
program.exec_and_exit();
}
```
@@ -584,7 +575,7 @@ use mingling::StructuralData;
use serde::Serialize;
use std::io::Write;
-dispatcher!("render", CMDRender => EntryRender);
+dispatcher!("render", EntryRender);
#[derive(Default, StructuralData, Serialize, Grouped)]
struct ResultInfo {
@@ -609,7 +600,6 @@ fn render_info_result(info: ResultInfo) {
fn main() {
let mut program = ThisProgram::new();
program.with_setup(StructuralRendererSetup); // enables --json / --yaml
- program.with_dispatcher(CMDRender);
let _ = program.exec();
}
```
@@ -642,7 +632,7 @@ Enable the `async` feature to use `async fn` inside `#[chain]`:
use std::io::Write;
use std::time::Duration;
-dispatcher!("download", CMDDownload => EntryDownload);
+dispatcher!("download", EntryDownload);
pack!(ResultDownloaded = String);
#[chain]
@@ -693,11 +683,10 @@ use mingling::macros::pack;
use mingling::prelude::*;
use std::io::Write;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
- program.with_dispatcher(CMDGreet);
program.exec_and_exit();
}
diff --git a/README.md b/README.md
index 480510c..91aa166 100644
--- a/README.md
+++ b/README.md
@@ -38,7 +38,7 @@ Additionally, the project is currently developed by me alone ([Weicao-CatilGrass
Mingling abstracts the behavior of a program's lifecycle into three phases: **Dispatch**, **Execution**, and **Rendering**. Each phase is connected by types — the output of the current phase becomes the input of the next phase. For example:
```rust
-dispatcher!("current", CMDCurrent => EntryCurrent);
+dispatcher!("current", EntryCurrent);
pack!(StateNext = ());
#[chain]
@@ -65,7 +65,7 @@ You can use this approach to separate computation from result rendering, like th
use mingling::macros::buffer;
use mingling::prelude::*;
-dispatcher!("calc", CMDCalculate => EntryCalculate);
+dispatcher!("calc", EntryCalculate);
pack!(StateSumNumbers = Vec);
pack!(ResultNumber = i32);
diff --git a/docs/_zh_CN/pages/10-help.md b/docs/_zh_CN/pages/10-help.md
index 99a81fd..6043abc 100644
--- a/docs/_zh_CN/pages/10-help.md
+++ b/docs/_zh_CN/pages/10-help.md
@@ -14,7 +14,7 @@ Mingling 里用 `#[help]` 宏给命令添加帮助文本。
```rust
@@@use mingling::macros::help;
@@@use mingling::macros::buffer;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
#[help(buffer)]
fn help_greet(_entry: EntryGreet) {
r_println!("Usage: greet [name]");
@@ -51,7 +51,7 @@ fn help_root(entry: EntryFallback) {
```rust
@@@use mingling::macros::help;
@@@use mingling::setup::BasicProgramSetup;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
program.with_setup(BasicProgramSetup);
diff --git a/docs/_zh_CN/pages/11-resource-system.md b/docs/_zh_CN/pages/11-resource-system.md
index b127a3a..40d8cd9 100644
--- a/docs/_zh_CN/pages/11-resource-system.md
+++ b/docs/_zh_CN/pages/11-resource-system.md
@@ -30,7 +30,7 @@ fn main() {
@@@use mingling::macros::buffer;
@@@#[derive(Default, Clone)]
@@@struct ResCurrentDir(String);
-@@@dispatcher!("pwd", CMDPrintWorkingDir => EntryPrintWorkingDir);
+@@@dispatcher!("pwd", EntryPrintWorkingDir);
@@@pack!(ResultPath = String);
// 通过 &T 注入只读资源
#[chain]
@@ -52,7 +52,7 @@ fn render_path(result: ResultPath) {
@@@use mingling::macros::buffer;
@@@#[derive(Default, Clone)]
@@@struct ResVisitCount(u32);
-@@@dispatcher!("visit", CMDVisit => EntryVisit);
+@@@dispatcher!("visit", EntryVisit);
@@@pack!(ResultDone = ());
#[chain]
fn handle_visit(_args: EntryVisit, counter: &mut ResVisitCount) -> Next {
@@ -73,7 +73,7 @@ Chain 可以同时注入任意多个资源,框架按类型自动匹配:
```rust
@@@#[derive(Default, Clone)] struct ResConfig(String);
@@@#[derive(Default, Clone)] struct ResCounter(u32);
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultDone = ());
// 同时注入只读 + 可修改
#[chain]
diff --git a/docs/_zh_CN/pages/13-hook.md b/docs/_zh_CN/pages/13-hook.md
index 2aa3ef7..811957c 100644
--- a/docs/_zh_CN/pages/13-hook.md
+++ b/docs/_zh_CN/pages/13-hook.md
@@ -54,7 +54,7 @@ Hook 覆盖了管线的完整生命周期:
@@@use mingling::prelude::*;
@@@use mingling::hook::ProgramHook;
@@@
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@
@@@#[chain] fn handle_greet(args: EntryGreet) -> Next {
diff --git a/docs/_zh_CN/pages/14-testing.md b/docs/_zh_CN/pages/14-testing.md
index 3567aef..30f3fc4 100644
--- a/docs/_zh_CN/pages/14-testing.md
+++ b/docs/_zh_CN/pages/14-testing.md
@@ -35,7 +35,7 @@ fn test_render_name() {
```rust
@@@use mingling::{assert_member_id, assert_render_result, unpack_chain_process};
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultName = String);
@@@pack!(ErrorNoName = ());
@@@#[chain]
@@ -77,7 +77,7 @@ fn test_handle_hello_with_name() {
@@@use mingling::{assert_member_id, unpack_chain_process};
@@@use mingling::macros::entry;
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_hello(args: EntryHello) -> Next {
@@ -102,7 +102,7 @@ fn test_with_entry_macro() {
@@@use mingling::{assert_render_result, unpack_chain_process};
@@@#[derive(Default, Clone)]
@@@struct ResPrefix(String);
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultGreeting = String);
@@@
#[chain]
diff --git a/docs/_zh_CN/pages/2-define-a-dispatcher.md b/docs/_zh_CN/pages/2-define-a-dispatcher.md
index 4ec7c05..7ae26f1 100644
--- a/docs/_zh_CN/pages/2-define-a-dispatcher.md
+++ b/docs/_zh_CN/pages/2-define-a-dispatcher.md
@@ -19,13 +19,13 @@ Mingling 的管线从 Dispatcher 开始。
写法是固定的三个部分:
```rust
-dispatcher!("命令路径", 分发器类型 => 入口类型);
+dispatcher!("命令路径", 入口类型);
```
看一个具体的例子:
```rust
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
```
> [!NOTE]
@@ -36,8 +36,8 @@ dispatcher!("greet", CMDGreet => EntryGreet);
如果你的程序有层级结构——比如 `remote add`、`remote rm`——只需要在命令名里加点号分隔:
```rust
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
-dispatcher!("remote.rm", CMDRemoteRm => EntryRemoteRm);
+dispatcher!("remote.add", EntryRemoteAdd);
+dispatcher!("remote.rm", EntryRemoteRm);
```
用户在终端输入 `remote add` 时,Mingling 会依次匹配 `remote` 和 `add` 两个层级。
@@ -68,7 +68,7 @@ pub struct EntryGreet {
// Features: ["extras"]
// 省略 CMDType 和 EntryType,名字自动推导
dispatcher!("greet");
-// dispatcher!("greet", CMDGreet => EntryGreet);
+// dispatcher!("greet", EntryGreet);
```
这种写法会自动生成 `CMDGreet` 和 `EntryGreet`,效果跟显式声明完全一样。
diff --git a/docs/_zh_CN/pages/3-define-a-chain.md b/docs/_zh_CN/pages/3-define-a-chain.md
index b1becc9..bf30b91 100644
--- a/docs/_zh_CN/pages/3-define-a-chain.md
+++ b/docs/_zh_CN/pages/3-define-a-chain.md
@@ -3,7 +3,7 @@
使用 chain 宏声明链,并承接 Entry 输入
-上一节我们声明了 `dispatcher!("greet", CMDGreet => EntryGreet)`
+上一节我们声明了 `dispatcher!("greet", EntryGreet)`
现在用户输入 `greet` 时会被匹配并包装成 `EntryGreet`。
@@ -16,7 +16,7 @@
`#[chain]` 用来标记一个处理函数,格式非常直接:
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
pack!(ResultName = String);
#[chain]
@@ -77,7 +77,7 @@ pub struct ResultName {
`EntryGreet` 的 `inner` 是一个 `Vec`,你可以在 Chain 里自由地处理它:
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
fn handle_greet(args: EntryGreet) -> Next {
@@ -100,7 +100,7 @@ fn handle_greet(args: EntryGreet) -> Next {
```rust
// 1. 声明命令
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// 2. 声明管线中的数据类型
pack!(ResultName = String);
diff --git a/docs/_zh_CN/pages/4-render-result.md b/docs/_zh_CN/pages/4-render-result.md
index 2dbb617..e3e49f5 100644
--- a/docs/_zh_CN/pages/4-render-result.md
+++ b/docs/_zh_CN/pages/4-render-result.md
@@ -52,7 +52,7 @@ fn render_name(name: ResultName) {
use mingling::macros::buffer;
// 1. 用 Dispatcher 声明命令
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// 2. 用 pack! 声明结果数据
pack!(ResultName = String);
diff --git a/docs/_zh_CN/pages/5-multiple-commands.md b/docs/_zh_CN/pages/5-multiple-commands.md
index b251232..e0a58e7 100644
--- a/docs/_zh_CN/pages/5-multiple-commands.md
+++ b/docs/_zh_CN/pages/5-multiple-commands.md
@@ -12,8 +12,8 @@
```rust
@@@use mingling::macros::buffer;
// 声明两个命令
-dispatcher!("greet", CMDGreet => EntryGreet);
-dispatcher!("add", CMDAdd => EntryAdd);
+dispatcher!("greet", EntryGreet);
+dispatcher!("add", EntryAdd);
pack!(ResultGreeting = String);
pack!(ResultSum = i32);
@@ -62,8 +62,8 @@ Sum: 6
多层级的命令也是同理——每个点号分隔的层级都只是名字的一部分:
```rust
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
-dispatcher!("remote.rm", CMDRemoteRm => EntryRemoteRm);
+dispatcher!("remote.add", EntryRemoteAdd);
+dispatcher!("remote.rm", EntryRemoteRm);
```
每个子命令的 Entry、Chain、Renderer 完全独立,互不干扰。
diff --git a/docs/_zh_CN/pages/6-argument-parse-picker.md b/docs/_zh_CN/pages/6-argument-parse-picker.md
index 462a912..33f1f0d 100644
--- a/docs/_zh_CN/pages/6-argument-parse-picker.md
+++ b/docs/_zh_CN/pages/6-argument-parse-picker.md
@@ -26,7 +26,7 @@ features = ["parser"]
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -42,7 +42,7 @@ fn handle_greet_entry(prev: EntryGreet) -> Next {
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) -> Next {
@@ -55,7 +55,7 @@ let name = prev.pick_or((), "World").unpack();
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -76,7 +76,7 @@ let name = prev.pick_or((), "World").unpack();
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -90,7 +90,7 @@ fn handle_greet_entry(prev: EntryGreet) -> Next {
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -113,7 +113,7 @@ fn handle_greet_entry(prev: EntryGreet) -> Next {
```rust
// Features: ["parser"]
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultInfo = (String, u8, u32));
#[chain]
@@ -141,7 +141,7 @@ fn handle_test_entry(prev: EntryTest) -> Next {
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNoName = ());
@@ -200,7 +200,7 @@ let name = match pick_result {
````rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -226,7 +226,7 @@ fn handle_greet_entry(prev: EntryGreet) -> Next {
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNameTooLong = usize);
@@ -276,7 +276,7 @@ fn render_name(prev: ResultName) {
```rust
// Features: ["parser"]
@@@use mingling::parser::Yes;
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultDone = ());
#[chain]
@@ -329,7 +329,7 @@ impl Pickable for Address {
Some(Address { ip, port })
}
}
-@@@dispatcher!("connect", CMDConnect => EntryConnect);
+@@@dispatcher!("connect", EntryConnect);
@@@pack!(ResultConnected = Address);
#[chain]
@@ -369,7 +369,7 @@ pub enum Fruits {
}
impl PickableEnum for Fruits {}
-@@@dispatcher!("eat", CMDEat => EntryEat);
+@@@dispatcher!("eat", EntryEat);
@@@pack!(ResultFruit = Fruits);
#[chain]
diff --git a/docs/_zh_CN/pages/7-argument-parse-clap.md b/docs/_zh_CN/pages/7-argument-parse-clap.md
index 83dddc3..e9475ae 100644
--- a/docs/_zh_CN/pages/7-argument-parse-clap.md
+++ b/docs/_zh_CN/pages/7-argument-parse-clap.md
@@ -27,7 +27,7 @@ features = ["derive", "color"]
@@@ use mingling::macros::dispatcher_clap;
@@@ use mingling::macros::buffer;
#[derive(Default, clap::Parser, Grouped)]
-#[dispatcher_clap("greet", CMDGreet, help = true, error = ErrorGreetParsed)]
+#[dispatcher_clap("greet", help = true, error = ErrorGreetParsed)]
pub struct EntryGreet {
#[clap(default_value = "World")]
name: String,
@@ -63,7 +63,7 @@ fn render_greet_parse_failed(err: ErrorGreetParsed) {
@@@use mingling::setup::BasicProgramSetup;
@@@use mingling::macros::dispatcher_clap;
@@@#[derive(Default, clap::Parser, Grouped)]
-@@@#[dispatcher_clap("greet", CMDGreet)]
+@@@#[dispatcher_clap("greet", )]
@@@pub struct EntryGreet {
@@@ name: String,
@@@}
diff --git a/docs/_zh_CN/pages/9-error-handling.md b/docs/_zh_CN/pages/9-error-handling.md
index 222ef44..dce48d1 100644
--- a/docs/_zh_CN/pages/9-error-handling.md
+++ b/docs/_zh_CN/pages/9-error-handling.md
@@ -19,7 +19,7 @@
## 用独立类型区分错误
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
pack!(ErrorNameEmpty = String);
@@ -39,7 +39,7 @@ fn handle_greet(args: EntryGreet) -> Next {
```rust
@@@use mingling::macros::buffer;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultGreeting = String);
@@@pack!(ErrorNameEmpty = String);
@@@#[chain] fn handle_greet(args: EntryGreet) -> Next { ResultGreeting::new(args.inner.first().cloned().unwrap_or_default()).to_render() }
@@ -61,7 +61,7 @@ fn render_error_name_empty(err: ErrorNameEmpty) {
```rust
@@@use mingling::macros::buffer;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
pack!(ErrorNameEmpty = String);
diff --git a/docs/_zh_CN/pages/advanced/1-completion.md b/docs/_zh_CN/pages/advanced/1-completion.md
index c7dd678..28587b3 100644
--- a/docs/_zh_CN/pages/advanced/1-completion.md
+++ b/docs/_zh_CN/pages/advanced/1-completion.md
@@ -40,7 +40,7 @@ features = [
@@@use mingling::prelude::*;
@@@use mingling::{ShellContext, Suggest, SuggestItem};
@@@use std::collections::BTreeSet;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
#[completion(EntryGreet)]
fn complete_greet(ctx: &ShellContext) -> Suggest {
diff --git a/docs/_zh_CN/pages/advanced/2-structural-renderer.md b/docs/_zh_CN/pages/advanced/2-structural-renderer.md
index 9723247..f2e1717 100644
--- a/docs/_zh_CN/pages/advanced/2-structural-renderer.md
+++ b/docs/_zh_CN/pages/advanced/2-structural-renderer.md
@@ -29,7 +29,7 @@ features = ["structural_renderer"]
// serde = "1"
@@@use mingling::macros::buffer;
@@@use mingling::setup::StructuralRendererSetup;
-@@@dispatcher!("render", CMDRender => EntryRender);
+@@@dispatcher!("render", EntryRender);
// pack_structural! 等价于 pack! + StructuralData
pack_structural!(ResultInfo = (String, i32));
@@ -72,7 +72,7 @@ fn render_info(r: ResultInfo) {
@@@use mingling::setup::StructuralRendererSetup;
@@@use mingling::StructuralData;
@@@use serde::Serialize;
-@@@dispatcher!("render", CMDRender => EntryRender);
+@@@dispatcher!("render", EntryRender);
#[derive(Serialize, StructuralData, Grouped)]
struct Info {
diff --git a/docs/_zh_CN/pages/other/features.md b/docs/_zh_CN/pages/other/features.md
index 7ed3f5f..4913945 100644
--- a/docs/_zh_CN/pages/other/features.md
+++ b/docs/_zh_CN/pages/other/features.md
@@ -151,14 +151,14 @@ build_comp_scripts("myprogram").unwrap();
例如,允许 `dispatcher!("greet")` 的缩写形式,自动生成 `CMDGreet` / `EntryGreet`。
-| 宏 | 说明 |
-| ------------------------------------------------------- | --------------------------------------------- |
-| `empty_result!()` | 链中提前返回空结果的简写 |
-| `entry!(Type, ["a", "b"])` | 构造入口类型的测试数据 |
-| `group!(Type)` | 将外部类型注册为组成员,无需修改其定义 |
-| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | 创建带自动 `name` 字段的错误类型 |
-| `#[program_setup]` | 声明程序初始化函数 |
-| `dispatcher!("cmd.path")` **缩写形式** | 省略 `CMDStruct => EntryStruct`,名字自动推导 |
+| 宏 | 说明 |
+| ------------------------------------------------------- | -------------------------------------- |
+| `empty_result!()` | 链中提前返回空结果的简写 |
+| `entry!(Type, ["a", "b"])` | 构造入口类型的测试数据 |
+| `group!(Type)` | 将外部类型注册为组成员,无需修改其定义 |
+| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | 创建带自动 `name` 字段的错误类型 |
+| `#[program_setup]` | 声明程序初始化函数 |
+| `dispatcher!("cmd.path")` **缩写形式** | 省略 `EntryStruct`,入口类型名自动推导 |
Details
diff --git a/docs/_zh_CN/pages/other/naming_rule.md b/docs/_zh_CN/pages/other/naming_rule.md
index 6e65ee4..1bca8f6 100644
--- a/docs/_zh_CN/pages/other/naming_rule.md
+++ b/docs/_zh_CN/pages/other/naming_rule.md
@@ -40,19 +40,17 @@ Res + 名称
### 分发器
-分发器是命令的入口点,与 `Node` 名称一一对应。节点名用 `.` 分隔层级,分发器名用 `CMD` 前缀加 PascalCase。
+分发器是命令的入口点。命令名用 `.` 分隔层级,与用户输入的命令参数一一对应。
```
-CMD + 命令层级
+命令名
```
-| 节点 | 分发器 |
-| ------------ | ----------------- |
-| `greet` | `CMDGreet` |
-| `remote.add` | `CMDRemoteAdd` |
-| `remote.rm` | `CMDRemoteRemove` |
-
-即使节点是缩写,分发器的名称也要写全名。例如节点是 `remote.rm`,分发器是 `CMDRemoteRemove`,不是 `CMDRemoteRm`。
+| 命令 |
+| ------------ |
+| `greet` |
+| `remote.add` |
+| `remote.rm` |
### 入口
@@ -62,11 +60,11 @@ CMD + 命令层级
Entry + 命令层级
```
-| 分发器 | 入口 |
-| ----------------- | ------------------- |
-| `CMDGreet` | `EntryGreet` |
-| `CMDRemoteAdd` | `EntryRemoteAdd` |
-| `CMDRemoteRemove` | `EntryRemoteRemove` |
+| 命令 | 入口 |
+| ------------ | ------------------- |
+| `greet` | `EntryGreet` |
+| `remote.add` | `EntryRemoteAdd` |
+| `remote.rm` | `EntryRemoteRemove` |
### 状态
@@ -174,7 +172,7 @@ fn handle_remote_add(args: EntryRemoteAdd, cwd: &ResCurrentDir, db: &mut ResData
@@@ pack!(ResultRemoteAdded = String);
@@@ pack!(ErrorRepositoryNotFound = String);
// 分发器
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
+dispatcher!("remote.add", EntryRemoteAdd);
// 入口 → 状态
#[chain]
diff --git a/docs/pages/10-help.md b/docs/pages/10-help.md
index 3d4b3b8..b378a61 100644
--- a/docs/pages/10-help.md
+++ b/docs/pages/10-help.md
@@ -14,7 +14,7 @@ Write a help function directly for an Entry:
```rust
@@@use mingling::macros::help;
@@@use mingling::macros::buffer;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
#[help(buffer)]
fn help_greet(_entry: EntryGreet) {
r_println!("Usage: greet [name]");
@@ -51,7 +51,7 @@ For `--help` to work properly, add `BasicProgramSetup` in `main`:
```rust
@@@use mingling::macros::help;
@@@use mingling::setup::BasicProgramSetup;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
program.with_setup(BasicProgramSetup);
diff --git a/docs/pages/11-resource-system.md b/docs/pages/11-resource-system.md
index 0e2bd19..3a4dc36 100644
--- a/docs/pages/11-resource-system.md
+++ b/docs/pages/11-resource-system.md
@@ -30,7 +30,7 @@ In a Chain or Renderer, simply declare the resource in the parameter list:
@@@use mingling::macros::buffer;
@@@#[derive(Default, Clone)]
@@@struct ResCurrentDir(String);
-@@@dispatcher!("pwd", CMDPrintWorkingDir => EntryPrintWorkingDir);
+@@@dispatcher!("pwd", EntryPrintWorkingDir);
@@@pack!(ResultPath = String);
// Inject read-only resource via &T
#[chain]
@@ -52,7 +52,7 @@ Use `&mut T` to inject a mutable resource:
@@@use mingling::macros::buffer;
@@@#[derive(Default, Clone)]
@@@struct ResVisitCount(u32);
-@@@dispatcher!("visit", CMDVisit => EntryVisit);
+@@@dispatcher!("visit", EntryVisit);
@@@pack!(ResultDone = ());
#[chain]
fn handle_visit(_args: EntryVisit, counter: &mut ResVisitCount) -> Next {
@@ -73,7 +73,7 @@ A Chain can inject any number of resources at once — the framework matches the
```rust
@@@#[derive(Default, Clone)] struct ResConfig(String);
@@@#[derive(Default, Clone)] struct ResCounter(u32);
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultDone = ());
// Inject both read-only and mutable resources
#[chain]
diff --git a/docs/pages/13-hook.md b/docs/pages/13-hook.md
index c525998..90df379 100644
--- a/docs/pages/13-hook.md
+++ b/docs/pages/13-hook.md
@@ -54,7 +54,7 @@ Each hook callback receives a corresponding `Hook*Info` struct containing contex
@@@use mingling::prelude::*;
@@@use mingling::hook::ProgramHook;
@@@
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@
@@@#[chain] fn handle_greet(args: EntryGreet) -> Next {
diff --git a/docs/pages/14-testing.md b/docs/pages/14-testing.md
index 86171bf..9f6b6ed 100644
--- a/docs/pages/14-testing.md
+++ b/docs/pages/14-testing.md
@@ -35,7 +35,7 @@ Testing a Chain is slightly more complex because its return value is `Next` (act
```rust
@@@use mingling::{assert_member_id, assert_render_result, unpack_chain_process};
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultName = String);
@@@pack!(ErrorNoName = ());
@@@#[chain]
@@ -77,7 +77,7 @@ If `extras` is enabled, you can use `entry!` to quickly construct an Entry:
@@@use mingling::{assert_member_id, unpack_chain_process};
@@@use mingling::macros::entry;
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_hello(args: EntryHello) -> Next {
@@ -102,7 +102,7 @@ If a Chain uses resources, you need to provide resource instances in the test:
@@@use mingling::{assert_render_result, unpack_chain_process};
@@@#[derive(Default, Clone)]
@@@struct ResPrefix(String);
-@@@dispatcher!("hello", CMDHello => EntryHello);
+@@@dispatcher!("hello", EntryHello);
@@@pack!(ResultGreeting = String);
@@@
#[chain]
diff --git a/docs/pages/2-define-a-dispatcher.md b/docs/pages/2-define-a-dispatcher.md
index 432d7db..efd744d 100644
--- a/docs/pages/2-define-a-dispatcher.md
+++ b/docs/pages/2-define-a-dispatcher.md
@@ -19,13 +19,13 @@ The `dispatcher!` macro generates two types at once:
The syntax is a fixed three-part pattern:
```rust
-dispatcher!("command path", DispatcherType => EntryType);
+dispatcher!("command path", EntryType);
```
Here's a concrete example:
```rust
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
```
> [!NOTE]
@@ -36,8 +36,8 @@ dispatcher!("greet", CMDGreet => EntryGreet);
If your program has a hierarchy — e.g., `remote add`, `remote rm` — just separate the command name with dots:
```rust
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
-dispatcher!("remote.rm", CMDRemoteRm => EntryRemoteRm);
+dispatcher!("remote.add", EntryRemoteAdd);
+dispatcher!("remote.rm", EntryRemoteRm);
```
When the user types `remote add` in the terminal, Mingling matches `remote` and `add` as two levels in sequence.
@@ -68,7 +68,7 @@ The above is the standard syntax. If you enable the `extras` feature, you can be
// Features: ["extras"]
// Omit CMDType and EntryType, names are auto-derived
dispatcher!("greet");
-// dispatcher!("greet", CMDGreet => EntryGreet);
+// dispatcher!("greet", EntryGreet);
```
This syntax auto-generates `CMDGreet` and `EntryGreet`, with the same effect as the explicit declaration.
diff --git a/docs/pages/3-define-a-chain.md b/docs/pages/3-define-a-chain.md
index 1134dbf..dca299e 100644
--- a/docs/pages/3-define-a-chain.md
+++ b/docs/pages/3-define-a-chain.md
@@ -3,7 +3,7 @@
Use the chain macro to declare a chain and handle Entry input
-In the previous section, we declared `dispatcher!("greet", CMDGreet => EntryGreet)`.
+In the previous section, we declared `dispatcher!("greet", EntryGreet)`.
Now when a user types `greet`, it gets matched and wrapped into `EntryGreet`.
@@ -16,7 +16,7 @@ We need a Chain to process it.
`#[chain]` marks a handler function. The format is straightforward:
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
pack!(ResultName = String);
#[chain]
@@ -77,7 +77,7 @@ See [Naming Convention](pages/other/naming_rule) for details, but for now just r
`EntryGreet`'s `inner` is a `Vec`, which you can freely process inside a Chain:
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
fn handle_greet(args: EntryGreet) -> Next {
@@ -100,7 +100,7 @@ Now let's connect the Dispatcher and Chain:
```rust
// 1. Declare the command
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// 2. Declare the pipeline data type
pack!(ResultName = String);
diff --git a/docs/pages/4-render-result.md b/docs/pages/4-render-result.md
index a50c509..fdf8b12 100644
--- a/docs/pages/4-render-result.md
+++ b/docs/pages/4-render-result.md
@@ -52,7 +52,7 @@ Putting all three tutorials together, here's your first complete Mingling progra
use mingling::macros::buffer;
// 1. Declare commands with a Dispatcher
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// 2. Declare result data with pack!
pack!(ResultName = String);
diff --git a/docs/pages/5-multiple-commands.md b/docs/pages/5-multiple-commands.md
index b92cb95..a5c09b0 100644
--- a/docs/pages/5-multiple-commands.md
+++ b/docs/pages/5-multiple-commands.md
@@ -12,8 +12,8 @@ Work in the same project:
```rust
@@@use mingling::macros::buffer;
// Declare two commands
-dispatcher!("greet", CMDGreet => EntryGreet);
-dispatcher!("add", CMDAdd => EntryAdd);
+dispatcher!("greet", EntryGreet);
+dispatcher!("add", EntryAdd);
pack!(ResultGreeting = String);
pack!(ResultSum = i32);
@@ -62,8 +62,8 @@ Sum: 6
Multi-level commands work the same way—each dot-separated level is just part of the name:
```rust
-dispatcher!("remote.add", CMDRemoteAdd => EntryRemoteAdd);
-dispatcher!("remote.rm", CMDRemoteRm => EntryRemoteRm);
+dispatcher!("remote.add", EntryRemoteAdd);
+dispatcher!("remote.rm", EntryRemoteRm);
```
Each subcommand's Entry, Chain, and Renderer are completely independent and don't interfere.
diff --git a/docs/pages/6-argument-parse-picker.md b/docs/pages/6-argument-parse-picker.md
index d7d38af..9da56d5 100644
--- a/docs/pages/6-argument-parse-picker.md
+++ b/docs/pages/6-argument-parse-picker.md
@@ -26,7 +26,7 @@ Now let's see how `Picker` is written:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -42,7 +42,7 @@ For the code above:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) -> Next {
@@ -55,7 +55,7 @@ Its semantics are:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -76,7 +76,7 @@ If your program needs to parse flag arguments (e.g. `greet --name Alice`), do th
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -90,7 +90,7 @@ Its semantics:
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@#[chain]
@@@fn handle_greet_entry(prev: EntryGreet) {
@@ -113,7 +113,7 @@ For a single pick, `.unpack()` returns the value directly; for multiple picks, i
```rust
// Features: ["parser"]
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultInfo = (String, u8, u32));
#[chain]
@@ -141,7 +141,7 @@ Here's a simple example:
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNoName = ());
@@ -200,7 +200,7 @@ After picking user input with `pick`, you can use `after` to process it immediat
```rust
// Features: ["parser"]
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
#[chain]
@@ -226,7 +226,7 @@ Similarly, you can use `after_or_route` to handle input format errors:
// Features: ["parser", "extras"]
@@@use mingling::macros::buffer;
@@@use mingling::macros::route;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultName = String);
@@@pack!(ErrorNameTooLong = usize);
@@ -276,7 +276,7 @@ Implicit mode is generally sufficient, but for important confirmations, explicit
```rust
// Features: ["parser"]
@@@use mingling::parser::Yes;
-@@@dispatcher!("test", CMDTest => EntryTest);
+@@@dispatcher!("test", EntryTest);
@@@pack!(ResultDone = ());
#[chain]
@@ -329,7 +329,7 @@ impl Pickable for Address {
Some(Address { ip, port })
}
}
-@@@dispatcher!("connect", CMDConnect => EntryConnect);
+@@@dispatcher!("connect", EntryConnect);
@@@pack!(ResultConnected = Address);
#[chain]
@@ -369,7 +369,7 @@ pub enum Fruits {
}
impl PickableEnum for Fruits {}
-@@@dispatcher!("eat", CMDEat => EntryEat);
+@@@dispatcher!("eat", EntryEat);
@@@pack!(ResultFruit = Fruits);
#[chain]
diff --git a/docs/pages/7-argument-parse-clap.md b/docs/pages/7-argument-parse-clap.md
index ee1e96f..8b2ad0c 100644
--- a/docs/pages/7-argument-parse-clap.md
+++ b/docs/pages/7-argument-parse-clap.md
@@ -27,7 +27,7 @@ Add `#[dispatcher_clap]` on a `clap::Parser` struct to auto-generate a Dispatche
@@@ use mingling::macros::dispatcher_clap;
@@@ use mingling::macros::buffer;
#[derive(Default, clap::Parser, Grouped)]
-#[dispatcher_clap("greet", CMDGreet, help = true, error = ErrorGreetParsed)]
+#[dispatcher_clap("greet", help = true, error = ErrorGreetParsed)]
pub struct EntryGreet {
#[clap(default_value = "World")]
name: String,
@@ -63,7 +63,7 @@ If you need `--help` support, register `BasicProgramSetup` in main and set the c
@@@use mingling::setup::BasicProgramSetup;
@@@use mingling::macros::dispatcher_clap;
@@@#[derive(Default, clap::Parser, Grouped)]
-@@@#[dispatcher_clap("greet", CMDGreet)]
+@@@#[dispatcher_clap("greet", )]
@@@pub struct EntryGreet {
@@@ name: String,
@@@}
diff --git a/docs/pages/9-error-handling.md b/docs/pages/9-error-handling.md
index 389e394..eefc0f0 100644
--- a/docs/pages/9-error-handling.md
+++ b/docs/pages/9-error-handling.md
@@ -19,7 +19,7 @@ Error values can also take either path—you can render the error msg directly,
## Distinguish Errors with Dedicated Types
```rust
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
pack!(ErrorNameEmpty = String);
@@ -39,7 +39,7 @@ Then write separate Renderers:
```rust
@@@use mingling::macros::buffer;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
@@@pack!(ResultGreeting = String);
@@@pack!(ErrorNameEmpty = String);
@@@#[chain] fn handle_greet(args: EntryGreet) -> Next { ResultGreeting::new(args.inner.first().cloned().unwrap_or_default()).to_render() }
@@ -61,7 +61,7 @@ Each Renderer does its own job; what the user sees depends on what the Chain ret
```rust
@@@use mingling::macros::buffer;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
pack!(ErrorNameEmpty = String);
diff --git a/docs/pages/advanced/1-completion.md b/docs/pages/advanced/1-completion.md
index f70d415..55b8b1d 100644
--- a/docs/pages/advanced/1-completion.md
+++ b/docs/pages/advanced/1-completion.md
@@ -40,7 +40,7 @@ Use `#[completion(EntryType)]` to define completion logic for an Entry:
@@@use mingling::prelude::*;
@@@use mingling::{ShellContext, Suggest, SuggestItem};
@@@use std::collections::BTreeSet;
-@@@dispatcher!("greet", CMDGreet => EntryGreet);
+@@@dispatcher!("greet", EntryGreet);
#[completion(EntryGreet)]
fn complete_greet(ctx: &ShellContext) -> Suggest {
diff --git a/docs/pages/advanced/2-structural-renderer.md b/docs/pages/advanced/2-structural-renderer.md
index 489baba..e444ee6 100644
--- a/docs/pages/advanced/2-structural-renderer.md
+++ b/docs/pages/advanced/2-structural-renderer.md
@@ -29,7 +29,7 @@ After enabling `StructuralRendererSetup`, use `pack_structural!` instead of `pac
// serde = "1"
@@@use mingling::macros::buffer;
@@@use mingling::setup::StructuralRendererSetup;
-@@@dispatcher!("render", CMDRender => EntryRender);
+@@@dispatcher!("render", EntryRender);
// pack_structural! is equivalent to pack! + StructuralData
pack_structural!(ResultInfo = (String, i32));
@@ -72,7 +72,7 @@ The default output from `pack_structural!` includes an `inner` field. For full c
@@@use mingling::setup::StructuralRendererSetup;
@@@use mingling::StructuralData;
@@@use serde::Serialize;
-@@@dispatcher!("render", CMDRender => EntryRender);
+@@@dispatcher!("render", EntryRender);
#[derive(Serialize, StructuralData, Grouped)]
struct Info {
diff --git a/docs/pages/other/features.md b/docs/pages/other/features.md
index 7615118..4552d30 100644
--- a/docs/pages/other/features.md
+++ b/docs/pages/other/features.md
@@ -158,7 +158,7 @@ For example, allows the shorthand form `dispatcher!("greet")`, which auto-genera
| `group!(Type)` | Register external types as group members without modifying them |
| `pack_err!(ErrorType)` / `pack_err!(ErrorType = Inner)` | Create error types with an automatic `name` field |
| `#[program_setup]` | Declare a program initialization function |
-| `dispatcher!("cmd.path")` **shorthand** | Omit `CMDStruct => EntryStruct`, names are auto-derived |
+| `dispatcher!("cmd.path")` **shorthand** | Omit `EntryStruct`, the entry name is auto-derived |
Details
diff --git a/docs/pages/other/naming_rule.md b/docs/pages/other/naming_rule.md
index 1175ae0..770fd10 100644
--- a/docs/pages/other/naming_rule.md
+++ b/docs/pages/other/naming_rule.md
@@ -40,19 +40,17 @@ Name + Setup
### Dispatcher
-Dispatchers are the entry points of commands, corresponding one-to-one with `Node` names. Node names use `.` to separate levels, dispatcher names use the `CMD` prefix with PascalCase.
+Dispatchers are the entry points of commands. The command name uses `.` to separate hierarchy levels and matches the arguments typed by the user.
```
-CMD + Command Hierarchy
+command name
```
-| Node | Dispatcher |
-| ------------ | ----------------- |
-| `greet` | `CMDGreet` |
-| `remote.add` | `CMDRemoteAdd` |
-| `remote.rm` | `CMDRemoteRemove` |
-
-Even if a node is an abbreviation, the dispatcher name should use the full name. For example, the node is `remote.rm`, but the dispatcher is `CMDRemoteRemove`, not `CMDRemoteRm`.
+| Command |
+| ------------ |
+| `greet` |
+| `remote.add` |
+| `remote.rm` |
### Entry
@@ -62,11 +60,11 @@ Entries are the pipeline starting types created by dispatchers, wrapping `Vec EntryRemoteAdd);
+dispatcher!("remote.add", EntryRemoteAdd);
// Entry → State
#[chain]
diff --git a/docs/res/changlog_examples/feat_program_res.rs b/docs/res/changlog_examples/feat_program_res.rs
index 11a1471..5133000 100644
--- a/docs/res/changlog_examples/feat_program_res.rs
+++ b/docs/res/changlog_examples/feat_program_res.rs
@@ -20,7 +20,7 @@ fn main() {
program.exec();
}
-dispatcher!("modify", CMDModify => EntryModify);
+dispatcher!("modify", EntryModify);
pack!(DisplayGlobal = ());
diff --git a/examples/example-argument-parse/src/main.rs b/examples/example-argument-parse/src/main.rs
index d7c8681..d45c4af 100644
--- a/examples/example-argument-parse/src/main.rs
+++ b/examples/example-argument-parse/src/main.rs
@@ -21,8 +21,8 @@
use mingling::{macros::route, prelude::*};
use std::io::Write;
-dispatcher!("transfer", CMDTransfer => EntryTransfer);
-dispatcher!("strict-transfer", CMDStrictTransfer => EntryStrictTransfer);
+dispatcher!("transfer", EntryTransfer);
+dispatcher!("strict-transfer", EntryStrictTransfer);
pack!(ResultFile = (bool, usize, String)); // (IsDir, Size, Name)
diff --git a/examples/example-argument-picker/src/main.rs b/examples/example-argument-picker/src/main.rs
index 36b552e..99eee30 100644
--- a/examples/example-argument-picker/src/main.rs
+++ b/examples/example-argument-picker/src/main.rs
@@ -42,7 +42,7 @@ use mingling::setup::picker::BasicProgramSetup;
// --------- IMPORTANT ---------
-dispatcher!("calc", CMDCalculate => EntryCalculate);
+dispatcher!("calc", EntryCalculate);
pack_err!(ErrorNumberANotProvided);
pack_err!(ErrorNumberBNotProvided);
diff --git a/examples/example-async-support/src/main.rs b/examples/example-async-support/src/main.rs
index 1b6c194..ac1bcc1 100644
--- a/examples/example-async-support/src/main.rs
+++ b/examples/example-async-support/src/main.rs
@@ -39,7 +39,7 @@ async fn main() {
// --------- IMPORTANT ---------
}
-dispatcher!("download", CMDDownload => EntryDownload);
+dispatcher!("download", EntryDownload);
pack!(ResultDownloaded = String);
diff --git a/examples/example-basic/src/main.rs b/examples/example-basic/src/main.rs
index 418ed95..44736ad 100644
--- a/examples/example-basic/src/main.rs
+++ b/examples/example-basic/src/main.rs
@@ -22,7 +22,7 @@ use std::io::Write;
// | / _________ entry, records raw arguments
// | | / ^^^^^^^^^^^^^
// vvvvv vvvvvvvv vvvvvvvvvv \_ equivalent to pack!(EntryGreet = Vec)
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
// Create a new ThisProgram
diff --git a/examples/example-clap-binding/src/main.rs b/examples/example-clap-binding/src/main.rs
index 449fee3..6ff963b 100644
--- a/examples/example-clap-binding/src/main.rs
+++ b/examples/example-clap-binding/src/main.rs
@@ -71,7 +71,7 @@ fn main() {
// vvvvvvv vvvvvvvvvvvv vvvvvvv
#[derive(Default, clap::Parser, Grouped)]
#[dispatcher_clap(
- "greet", CMDGreet, // Bind EntryGreet to "greet" command
+ "greet", // Bind EntryGreet to "greet" command
help = true, // Generate clap help for EntryGreet
error = ErrorGreetParsed, // Generate and bind error type for parse failure
// ^^^^^\__ Using `error` intercepts parse failure information into the specified type,
diff --git a/examples/example-combine-pathf-metadata/src/sub/mod.rs b/examples/example-combine-pathf-metadata/src/sub/mod.rs
index 2e6776e..ba56285 100644
--- a/examples/example-combine-pathf-metadata/src/sub/mod.rs
+++ b/examples/example-combine-pathf-metadata/src/sub/mod.rs
@@ -8,7 +8,7 @@ use std::io::Write;
// Implicit dispatcher form — creates `CMDHello` / `EntryHello` in this module
dispatcher!("hello");
// Creates `CMDDescription` / `EntryDescription` in this module
-dispatcher!("desc", CMDDescription => EntryDescription);
+dispatcher!("desc", EntryDescription);
/// The metadata type attached to an entry (`DataType`).
#[derive(Debug, PartialEq, Eq)]
diff --git a/examples/example-command-macro/src/main.rs b/examples/example-command-macro/src/main.rs
index d080043..e525098 100644
--- a/examples/example-command-macro/src/main.rs
+++ b/examples/example-command-macro/src/main.rs
@@ -26,21 +26,21 @@ pack!(ResultGreeting = String);
pack!(ResultGoodbye = ());
// --------- IMPORTANT ---------
-// Auto-generates dispatcher!("hello.world", CMDHelloWorld => EntryHelloWorld);
+// Auto-generates dispatcher!("hello.world", EntryHelloWorld);
#[command]
fn hello_world() -> ResultGreeting {
ResultGreeting::new("World".to_string())
}
-// Auto-generates dispatcher!("hello-world", CMDGreetSomeone => EntryGreetSomeone);
+// Auto-generates dispatcher!("hello-world", EntryGreetSomeone);
#[command(node = "greet-someone")]
fn greet_someone(args: Vec) -> ResultGreeting {
let name = args.pick_or(&arg![String], || "World".to_string()).unwrap();
ResultGreeting::new(name)
}
-// Auto-generates dispatcher!("goodbye", CMDGoodBye => EntryGoodBye);
-#[command(name = CMDGoodBye, entry = EntryGoodBye)]
+// Auto-generates dispatcher!("goodbye", EntryGoodBye);
+#[command(entry = EntryGoodBye)]
fn goodbye() -> ResultGoodbye {
ResultGoodbye::default()
}
diff --git a/examples/example-completion/src/main.rs b/examples/example-completion/src/main.rs
index 29d6026..7de41f6 100644
--- a/examples/example-completion/src/main.rs
+++ b/examples/example-completion/src/main.rs
@@ -96,7 +96,7 @@ fn complete_greet_entry(ctx: &ShellContext) -> Suggest {
}
// --------- IMPORTANT ---------
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultName = (u8, String));
#[chain]
diff --git a/examples/example-custom-pickable/src/main.rs b/examples/example-custom-pickable/src/main.rs
index ece5d13..8265b09 100644
--- a/examples/example-custom-pickable/src/main.rs
+++ b/examples/example-custom-pickable/src/main.rs
@@ -41,7 +41,7 @@ impl Pickable for Address {
}
// --------- IMPORTANT ---------
-dispatcher!("connect", CMDConnect => EntryConnect);
+dispatcher!("connect", EntryConnect);
pack!(ErrorParseAddressFailed = ());
#[chain]
diff --git a/examples/example-dispatch-tree/src/main.rs b/examples/example-dispatch-tree/src/main.rs
index a25af2a..bba9c2e 100644
--- a/examples/example-dispatch-tree/src/main.rs
+++ b/examples/example-dispatch-tree/src/main.rs
@@ -23,20 +23,20 @@ use std::io::Write;
// --------- IMPORTANT ---------
// You have a large number of subcommands
-dispatcher!("cmd1", CMD1 => Entry1);
-dispatcher!("cmd2.sub1", CMD2Sub1 => Entry2Sub1);
-dispatcher!("cmd2.sub2", CMD2Sub2 => Entry2Sub2);
-dispatcher!("cmd3.sub1.leaf1", CMD3Sub1Leaf1 => Entry3Sub1Leaf1);
-dispatcher!("cmd3.sub1.leaf2", CMD3Sub1Leaf2 => Entry3Sub1Leaf2);
-dispatcher!("cmd3.sub2", CMD3Sub2 => Entry3Sub2);
-dispatcher!("cmd4.sub1.subsub1.deep", CMD4Deep => Entry4Deep);
-dispatcher!("cmd4.sub1.subsub2", CMD4SubSub2 => Entry4SubSub2);
-dispatcher!("cmd5", CMD5 => Entry5);
-dispatcher!("cmd5.extra", CMD5Extra => Entry5Extra);
-dispatcher!("nested.a.b.c", CMDA => EntryA);
-dispatcher!("nested.a.b.d", CMDB => EntryB);
-dispatcher!("nested.a.e", CMDC => EntryC);
-dispatcher!("nested.f", CMDD => EntryD);
+dispatcher!("cmd1", Entry1);
+dispatcher!("cmd2.sub1", Entry2Sub1);
+dispatcher!("cmd2.sub2", Entry2Sub2);
+dispatcher!("cmd3.sub1.leaf1", Entry3Sub1Leaf1);
+dispatcher!("cmd3.sub1.leaf2", Entry3Sub1Leaf2);
+dispatcher!("cmd3.sub2", Entry3Sub2);
+dispatcher!("cmd4.sub1.subsub1.deep", Entry4Deep);
+dispatcher!("cmd4.sub1.subsub2", Entry4SubSub2);
+dispatcher!("cmd5", Entry5);
+dispatcher!("cmd5.extra", Entry5Extra);
+dispatcher!("nested.a.b.c", EntryA);
+dispatcher!("nested.a.b.d", EntryB);
+dispatcher!("nested.a.e", EntryC);
+dispatcher!("nested.f", EntryD);
// --------- IMPORTANT ---------
fn main() {
diff --git a/examples/example-enum-tag/src/main.rs b/examples/example-enum-tag/src/main.rs
index 884bc1d..2966036 100644
--- a/examples/example-enum-tag/src/main.rs
+++ b/examples/example-enum-tag/src/main.rs
@@ -73,7 +73,7 @@ pub enum ProgrammingLanguages {
impl PickableEnum for ProgrammingLanguages {}
// --------- IMPORTANT ---------
-dispatcher!("lang-select", CMDLanguageSelection => EntryLanguageSelection);
+dispatcher!("lang-select", EntryLanguageSelection);
#[chain]
fn handle_language_selection(args: EntryLanguageSelection) -> Next {
diff --git a/examples/example-error-handling/src/main.rs b/examples/example-error-handling/src/main.rs
index e9c0f57..05b451b 100644
--- a/examples/example-error-handling/src/main.rs
+++ b/examples/example-error-handling/src/main.rs
@@ -26,7 +26,7 @@ use std::io::Write;
// In Mingling, instead of using ? to propagate errors upward,
// errors are treated as branches that continue execution.
-dispatcher!("hello", CMDHello => EntryHello);
+dispatcher!("hello", EntryHello);
// Define error types
pack!(ErrorNoNameProvided = ());
diff --git a/examples/example-exitcode/src/main.rs b/examples/example-exitcode/src/main.rs
index ad712cd..d3e035e 100644
--- a/examples/example-exitcode/src/main.rs
+++ b/examples/example-exitcode/src/main.rs
@@ -34,7 +34,7 @@ fn main() {
program.exec_and_exit();
}
-dispatcher!("hello", CMDHello => EntryHello);
+dispatcher!("hello", EntryHello);
pack!(ErrorNoNameProvided = ());
pack!(ResultName = String);
diff --git a/examples/example-help/src/main.rs b/examples/example-help/src/main.rs
index 90619f5..75170c7 100644
--- a/examples/example-help/src/main.rs
+++ b/examples/example-help/src/main.rs
@@ -16,7 +16,7 @@
use mingling::{macros::help, prelude::*, setup::BasicProgramSetup};
use std::io::Write;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// Define help _________ When `program.user_context.help` is `true`
// / the command will not enter `#[chain]` / `#[renderer]`
diff --git a/examples/example-hook/src/main.rs b/examples/example-hook/src/main.rs
index 1304f85..1807e5e 100644
--- a/examples/example-hook/src/main.rs
+++ b/examples/example-hook/src/main.rs
@@ -26,7 +26,7 @@ use mingling::{
};
use std::io::Write;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let mut program = ThisProgram::new();
diff --git a/examples/example-implicit-dispatcher/src/main.rs b/examples/example-implicit-dispatcher/src/main.rs
index 69adcfe..89a5ec3 100644
--- a/examples/example-implicit-dispatcher/src/main.rs
+++ b/examples/example-implicit-dispatcher/src/main.rs
@@ -4,9 +4,10 @@
use mingling::prelude::*;
-// When using implicit syntax, the entry and dispatcher names will be automatically derived
-dispatcher!("remote.add" /*, CMDRemoteAdd => EntryRemoteAdd */);
-dispatcher!("remote.remove", CMDRemoteRemove => EntryRemoteRemove);
+// When using implicit syntax, the entry name will be automatically derived
+// from the command name (the dispatcher struct is generated internally)
+dispatcher!("remote.add" /* => EntryRemoteAdd */);
+dispatcher!("remote.remove", EntryRemoteRemove);
fn main() {
ThisProgram::new().exec_and_exit();
diff --git a/examples/example-lazy-resources/src/main.rs b/examples/example-lazy-resources/src/main.rs
index 199608e..cc1604a 100644
--- a/examples/example-lazy-resources/src/main.rs
+++ b/examples/example-lazy-resources/src/main.rs
@@ -49,8 +49,8 @@ fn init_res_large_data() -> ResLargeData {
ResLargeData { data }
}
-dispatcher!("show", CMDShow => EntryShow);
-dispatcher!("none", CMDNone => EntryNone);
+dispatcher!("show", EntryShow);
+dispatcher!("none", EntryNone);
pack!(ResultShow = BTreeMap);
diff --git a/examples/example-metadata/src/main.rs b/examples/example-metadata/src/main.rs
index 5395614..94facb4 100644
--- a/examples/example-metadata/src/main.rs
+++ b/examples/example-metadata/src/main.rs
@@ -25,13 +25,13 @@ use mingling::{macros::metadata, prelude::*};
use std::io::Write;
// Define the `greet` subcommand
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
// Define the `desc` subcommand, which queries metadata bound to EntryGreet
-dispatcher!("desc", CMDDescription => EntryDescription);
+dispatcher!("desc", EntryDescription);
// Define the `nodoc` subcommand, which queries metadata for an entry that has none
-dispatcher!("nodoc", CMDNoDescription => EntryNoDescription);
+dispatcher!("nodoc", EntryNoDescription);
fn main() {
ThisProgram::new().exec_and_exit();
diff --git a/examples/example-pack-err/src/main.rs b/examples/example-pack-err/src/main.rs
index 901072d..e30e4cb 100644
--- a/examples/example-pack-err/src/main.rs
+++ b/examples/example-pack-err/src/main.rs
@@ -31,8 +31,8 @@ use mingling::setup::StructuralRendererSetup;
use std::io::Write;
use std::path::PathBuf;
-dispatcher!("find", CMDFind => EntryFind);
-dispatcher!("find-structural", CMDFindStructural => EntryFindStructural);
+dispatcher!("find", EntryFind);
+dispatcher!("find-structural", EntryFindStructural);
// --------- IMPORTANT ---------
// `pack_err!` is a convenient macro for defining error types.
diff --git a/examples/example-panic-unwind/src/main.rs b/examples/example-panic-unwind/src/main.rs
index 867e684..e1aa15c 100644
--- a/examples/example-panic-unwind/src/main.rs
+++ b/examples/example-panic-unwind/src/main.rs
@@ -19,7 +19,7 @@ use mingling::config::PanicSilence;
use mingling::{hook::ProgramHook, prelude::*};
use std::io::Write;
-dispatcher!("panic", CMDPanic => EntryPanic);
+dispatcher!("panic", EntryPanic);
pack!(NotPanic = ());
fn main() {
diff --git a/examples/example-pathfinder/src/sub/mod.rs b/examples/example-pathfinder/src/sub/mod.rs
index 8cbc1c5..cf0a97a 100644
--- a/examples/example-pathfinder/src/sub/mod.rs
+++ b/examples/example-pathfinder/src/sub/mod.rs
@@ -2,7 +2,7 @@ use crate::Next;
use mingling::prelude::*;
use std::io::Write;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultName = String);
#[chain]
diff --git a/examples/example-repl-basic/src/main.rs b/examples/example-repl-basic/src/main.rs
index dc3d2fe..325619e 100644
--- a/examples/example-repl-basic/src/main.rs
+++ b/examples/example-repl-basic/src/main.rs
@@ -73,10 +73,10 @@ fn main() {
pack!(ErrorDirectoryNotExist = PathBuf);
// Create commands: cd ls exit
-dispatcher!("cd", CMDCd => EntryCd);
-dispatcher!("ls", CMDLs => EntryLs);
-dispatcher!("exit", CMDExit => EntryExit);
-dispatcher!("clear", CMDClear => EntryClear);
+dispatcher!("cd", EntryCd);
+dispatcher!("ls", EntryLs);
+dispatcher!("exit", EntryExit);
+dispatcher!("clear", EntryClear);
// Define data needed for the cd command's execution phase
pack!(StateChangeDirectory = String);
diff --git a/examples/example-resources/src/main.rs b/examples/example-resources/src/main.rs
index 262680a..bb07d74 100644
--- a/examples/example-resources/src/main.rs
+++ b/examples/example-resources/src/main.rs
@@ -40,8 +40,8 @@ fn main() {
program.exec_and_exit();
}
-dispatcher!("current", CMDCurrent => EntryCurrent);
-dispatcher!("modify-current", CMDModifyCurrent => EntryModifyCurrent);
+dispatcher!("current", EntryCurrent);
+dispatcher!("modify-current", EntryModifyCurrent);
// Define chain for modifying current directory _________________ Injected muttable resource
// /
diff --git a/examples/example-setup/src/main.rs b/examples/example-setup/src/main.rs
index b497054..523a567 100644
--- a/examples/example-setup/src/main.rs
+++ b/examples/example-setup/src/main.rs
@@ -53,7 +53,7 @@ fn custom_setup(program: &mut Program) {
}
// --------- IMPORTANT ---------
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
pack!(ResultGreeting = String);
diff --git a/examples/example-structural-renderer/src/main.rs b/examples/example-structural-renderer/src/main.rs
index 8583d46..eca87fc 100644
--- a/examples/example-structural-renderer/src/main.rs
+++ b/examples/example-structural-renderer/src/main.rs
@@ -22,7 +22,7 @@ use mingling::{parser::Picker, setup::StructuralRendererSetup, Grouped, Structur
use serde::Serialize;
use std::io::Write;
-dispatcher!("render", CMDRender => EntryRender);
+dispatcher!("render", EntryRender);
fn main() {
let mut program = ThisProgram::new();
diff --git a/examples/example-unit-test/src/main.rs b/examples/example-unit-test/src/main.rs
index 140df90..29ff9da 100644
--- a/examples/example-unit-test/src/main.rs
+++ b/examples/example-unit-test/src/main.rs
@@ -65,7 +65,7 @@ mod tests {
// --------- IMPORTANT ---------
}
-dispatcher!("hello", CMDHello => EntryHello);
+dispatcher!("hello", EntryHello);
pack!(ErrorNoNameProvided = ());
pack!(ErrorNameTooLong = u16);
diff --git a/mingling/src/docs/lib.md b/mingling/src/docs/lib.md
index 993358b..91858d0 100644
--- a/mingling/src/docs/lib.md
+++ b/mingling/src/docs/lib.md
@@ -22,7 +22,7 @@ Here is a basic project written using **Mingling**:
```rust
use mingling::prelude::*;
-dispatcher!("greet", CMDGreet => EntryGreet);
+dispatcher!("greet", EntryGreet);
fn main() {
let program = ThisProgram::new();
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index 5e4df1b..5688793 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -41,8 +41,8 @@
/// use mingling::{macros::route, prelude::*};
/// use std::io::Write;
///
-/// dispatcher!("transfer", CMDTransfer => EntryTransfer);
-/// dispatcher!("strict-transfer", CMDStrictTransfer => EntryStrictTransfer);
+/// dispatcher!("transfer", EntryTransfer);
+/// dispatcher!("strict-transfer", EntryStrictTransfer);
///
/// pack!(ResultFile = (bool, usize, String)); // (IsDir, Size, Name)
///
@@ -184,7 +184,7 @@ pub mod example_argument_parse {}
///
/// // --------- IMPORTANT ---------
///
-/// dispatcher!("calc", CMDCalculate => EntryCalculate);
+/// dispatcher!("calc", EntryCalculate);
///
/// pack_err!(ErrorNumberANotProvided);
/// pack_err!(ErrorNumberBNotProvided);
@@ -430,7 +430,7 @@ pub mod example_argument_picker {}
/// // --------- IMPORTANT ---------
/// }
///
-/// dispatcher!("download", CMDDownload => EntryDownload);
+/// dispatcher!("download", EntryDownload);
///
/// pack!(ResultDownloaded = String);
///
@@ -499,7 +499,7 @@ pub mod example_async_support {}
/// // | / _________ entry, records raw arguments
/// // | | / ^^^^^^^^^^^^^
/// // vvvvv vvvvvvvv vvvvvvvvvv \_ equivalent to pack!(EntryGreet = Vec)
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
///
/// fn main() {
/// // Create a new ThisProgram
@@ -648,7 +648,7 @@ pub mod example_basic {}
/// // vvvvvvv vvvvvvvvvvvv vvvvvvv
/// #[derive(Default, clap::Parser, Grouped)]
/// #[dispatcher_clap(
-/// "greet", CMDGreet, // Bind EntryGreet to "greet" command
+/// "greet", // Bind EntryGreet to "greet" command
/// help = true, // Generate clap help for EntryGreet
/// error = ErrorGreetParsed, // Generate and bind error type for parse failure
/// // ^^^^^\__ Using `error` intercepts parse failure information into the specified type,
@@ -871,21 +871,21 @@ pub mod example_combine_pathf_metadata {}
/// pack!(ResultGoodbye = ());
///
/// // --------- IMPORTANT ---------
-/// // Auto-generates dispatcher!("hello.world", CMDHelloWorld => EntryHelloWorld);
+/// // Auto-generates dispatcher!("hello.world", EntryHelloWorld);
/// #[command]
/// fn hello_world() -> ResultGreeting {
/// ResultGreeting::new("World".to_string())
/// }
///
-/// // Auto-generates dispatcher!("hello-world", CMDGreetSomeone => EntryGreetSomeone);
+/// // Auto-generates dispatcher!("hello-world", EntryGreetSomeone);
/// #[command(node = "greet-someone")]
/// fn greet_someone(args: Vec) -> ResultGreeting {
/// let name = args.pick_or(&arg![String], || "World".to_string()).unwrap();
/// ResultGreeting::new(name)
/// }
///
-/// // Auto-generates dispatcher!("goodbye", CMDGoodBye => EntryGoodBye);
-/// #[command(name = CMDGoodBye, entry = EntryGoodBye)]
+/// // Auto-generates dispatcher!("goodbye", EntryGoodBye);
+/// #[command(entry = EntryGoodBye)]
/// fn goodbye() -> ResultGoodbye {
/// ResultGoodbye::default()
/// }
@@ -1035,7 +1035,7 @@ pub mod example_command_macro {}
/// }
/// // --------- IMPORTANT ---------
///
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
/// pack!(ResultName = (u8, String));
///
/// #[chain]
@@ -1124,7 +1124,7 @@ pub mod example_completion {}
/// }
/// // --------- IMPORTANT ---------
///
-/// dispatcher!("connect", CMDConnect => EntryConnect);
+/// dispatcher!("connect", EntryConnect);
/// pack!(ErrorParseAddressFailed = ());
///
/// #[chain]
@@ -1256,20 +1256,20 @@ pub mod example_custom_pickable {}
///
/// // --------- IMPORTANT ---------
/// // You have a large number of subcommands
-/// dispatcher!("cmd1", CMD1 => Entry1);
-/// dispatcher!("cmd2.sub1", CMD2Sub1 => Entry2Sub1);
-/// dispatcher!("cmd2.sub2", CMD2Sub2 => Entry2Sub2);
-/// dispatcher!("cmd3.sub1.leaf1", CMD3Sub1Leaf1 => Entry3Sub1Leaf1);
-/// dispatcher!("cmd3.sub1.leaf2", CMD3Sub1Leaf2 => Entry3Sub1Leaf2);
-/// dispatcher!("cmd3.sub2", CMD3Sub2 => Entry3Sub2);
-/// dispatcher!("cmd4.sub1.subsub1.deep", CMD4Deep => Entry4Deep);
-/// dispatcher!("cmd4.sub1.subsub2", CMD4SubSub2 => Entry4SubSub2);
-/// dispatcher!("cmd5", CMD5 => Entry5);
-/// dispatcher!("cmd5.extra", CMD5Extra => Entry5Extra);
-/// dispatcher!("nested.a.b.c", CMDA => EntryA);
-/// dispatcher!("nested.a.b.d", CMDB => EntryB);
-/// dispatcher!("nested.a.e", CMDC => EntryC);
-/// dispatcher!("nested.f", CMDD => EntryD);
+/// dispatcher!("cmd1", Entry1);
+/// dispatcher!("cmd2.sub1", Entry2Sub1);
+/// dispatcher!("cmd2.sub2", Entry2Sub2);
+/// dispatcher!("cmd3.sub1.leaf1", Entry3Sub1Leaf1);
+/// dispatcher!("cmd3.sub1.leaf2", Entry3Sub1Leaf2);
+/// dispatcher!("cmd3.sub2", Entry3Sub2);
+/// dispatcher!("cmd4.sub1.subsub1.deep", Entry4Deep);
+/// dispatcher!("cmd4.sub1.subsub2", Entry4SubSub2);
+/// dispatcher!("cmd5", Entry5);
+/// dispatcher!("cmd5.extra", Entry5Extra);
+/// dispatcher!("nested.a.b.c", EntryA);
+/// dispatcher!("nested.a.b.d", EntryB);
+/// dispatcher!("nested.a.e", EntryC);
+/// dispatcher!("nested.f", EntryD);
/// // --------- IMPORTANT ---------
///
/// fn main() {
@@ -1383,7 +1383,7 @@ pub mod example_dispatch_tree {}
/// impl PickableEnum for ProgrammingLanguages {}
/// // --------- IMPORTANT ---------
///
-/// dispatcher!("lang-select", CMDLanguageSelection => EntryLanguageSelection);
+/// dispatcher!("lang-select", EntryLanguageSelection);
///
/// #[chain]
/// fn handle_language_selection(args: EntryLanguageSelection) -> Next {
@@ -1457,7 +1457,7 @@ pub mod example_enum_tag {}
/// // In Mingling, instead of using ? to propagate errors upward,
/// // errors are treated as branches that continue execution.
///
-/// dispatcher!("hello", CMDHello => EntryHello);
+/// dispatcher!("hello", EntryHello);
///
/// // Define error types
/// pack!(ErrorNoNameProvided = ());
@@ -1594,7 +1594,7 @@ pub mod example_error_handling {}
/// program.exec_and_exit();
/// }
///
-/// dispatcher!("hello", CMDHello => EntryHello);
+/// dispatcher!("hello", EntryHello);
///
/// pack!(ErrorNoNameProvided = ());
/// pack!(ResultName = String);
@@ -1676,7 +1676,7 @@ pub mod example_exitcode {}
/// use mingling::{macros::help, prelude::*, setup::BasicProgramSetup};
/// use std::io::Write;
///
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
///
/// // Define help _________ When `program.user_context.help` is `true`
/// // / the command will not enter `#[chain]` / `#[renderer]`
@@ -1745,7 +1745,7 @@ pub mod example_help {}
/// };
/// use std::io::Write;
///
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
///
/// fn main() {
/// let mut program = ThisProgram::new();
@@ -1819,9 +1819,10 @@ pub mod example_hook {}
/// ```ignore
/// use mingling::prelude::*;
///
-/// // When using implicit syntax, the entry and dispatcher names will be automatically derived
-/// dispatcher!("remote.add" /*, CMDRemoteAdd => EntryRemoteAdd */);
-/// dispatcher!("remote.remove", CMDRemoteRemove => EntryRemoteRemove);
+/// // When using implicit syntax, the entry name will be automatically derived
+/// // from the command name (the dispatcher struct is generated internally)
+/// dispatcher!("remote.add" /* => EntryRemoteAdd */);
+/// dispatcher!("remote.remove", EntryRemoteRemove);
///
/// fn main() {
/// ThisProgram::new().exec_and_exit();
@@ -1897,8 +1898,8 @@ pub mod example_implicit_dispatcher {}
/// ResLargeData { data }
/// }
///
-/// dispatcher!("show", CMDShow => EntryShow);
-/// dispatcher!("none", CMDNone => EntryNone);
+/// dispatcher!("show", EntryShow);
+/// dispatcher!("none", EntryNone);
///
/// pack!(ResultShow = BTreeMap);
///
@@ -1987,13 +1988,13 @@ pub mod example_lazy_resources {}
/// use std::io::Write;
///
/// // Define the `greet` subcommand
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
///
/// // Define the `desc` subcommand, which queries metadata bound to EntryGreet
-/// dispatcher!("desc", CMDDescription => EntryDescription);
+/// dispatcher!("desc", EntryDescription);
///
/// // Define the `nodoc` subcommand, which queries metadata for an entry that has none
-/// dispatcher!("nodoc", CMDNoDescription => EntryNoDescription);
+/// dispatcher!("nodoc", EntryNoDescription);
///
/// fn main() {
/// ThisProgram::new().exec_and_exit();
@@ -2249,8 +2250,8 @@ pub mod example_outside_type {}
/// use std::io::Write;
/// use std::path::PathBuf;
///
-/// dispatcher!("find", CMDFind => EntryFind);
-/// dispatcher!("find-structural", CMDFindStructural => EntryFindStructural);
+/// dispatcher!("find", EntryFind);
+/// dispatcher!("find-structural", EntryFindStructural);
///
/// // --------- IMPORTANT ---------
/// // `pack_err!` is a convenient macro for defining error types.
@@ -2414,7 +2415,7 @@ pub mod example_pack_err {}
/// use mingling::{hook::ProgramHook, prelude::*};
/// use std::io::Write;
///
-/// dispatcher!("panic", CMDPanic => EntryPanic);
+/// dispatcher!("panic", EntryPanic);
/// pack!(NotPanic = ());
///
/// fn main() {
@@ -2611,10 +2612,10 @@ pub mod example_pathfinder {}
/// pack!(ErrorDirectoryNotExist = PathBuf);
///
/// // Create commands: cd ls exit
-/// dispatcher!("cd", CMDCd => EntryCd);
-/// dispatcher!("ls", CMDLs => EntryLs);
-/// dispatcher!("exit", CMDExit => EntryExit);
-/// dispatcher!("clear", CMDClear => EntryClear);
+/// dispatcher!("cd", EntryCd);
+/// dispatcher!("ls", EntryLs);
+/// dispatcher!("exit", EntryExit);
+/// dispatcher!("clear", EntryClear);
///
/// // Define data needed for the cd command's execution phase
/// pack!(StateChangeDirectory = String);
@@ -2777,8 +2778,8 @@ pub mod example_repl_basic {}
/// program.exec_and_exit();
/// }
///
-/// dispatcher!("current", CMDCurrent => EntryCurrent);
-/// dispatcher!("modify-current", CMDModifyCurrent => EntryModifyCurrent);
+/// dispatcher!("current", EntryCurrent);
+/// dispatcher!("modify-current", EntryModifyCurrent);
///
/// // Define chain for modifying current directory _________________ Injected muttable resource
/// // /
@@ -2878,7 +2879,7 @@ pub mod example_resources {}
/// }
/// // --------- IMPORTANT ---------
///
-/// dispatcher!("greet", CMDGreet => EntryGreet);
+/// dispatcher!("greet", EntryGreet);
///
/// pack!(ResultGreeting = String);
///
@@ -2952,7 +2953,7 @@ pub mod example_setup {}
/// use serde::Serialize;
/// use std::io::Write;
///
-/// dispatcher!("render", CMDRender => EntryRender);
+/// dispatcher!("render", EntryRender);
///
/// fn main() {
/// let mut program = ThisProgram::new();
@@ -3085,7 +3086,7 @@ pub mod example_structural_renderer {}
/// // --------- IMPORTANT ---------
/// }
///
-/// dispatcher!("hello", CMDHello => EntryHello);
+/// dispatcher!("hello", EntryHello);
///
/// pack!(ErrorNoNameProvided = ());
/// pack!(ErrorNameTooLong = u16);
diff --git a/mingling/src/gen_program.rs b/mingling/src/gen_program.rs
index b1fa118..2c476a2 100644
--- a/mingling/src/gen_program.rs
+++ b/mingling/src/gen_program.rs
@@ -4,7 +4,6 @@
use mingling_core::ChainProcess;
use mingling_core::Dispatcher;
use mingling_core::Grouped;
-use mingling_core::Node;
use mingling_core::Program;
use mingling_core::ProgramCollect;
@@ -96,18 +95,10 @@ pub struct CompletionSuggest {
#[cfg(feature = "comp")]
impl Dispatcher for CMDCompletion {
- fn node(&self) -> mingling_core::Node {
- Node::default().join(mingling_core::COMPLETION_SUBCOMMAND)
- }
-
fn begin(&self, args: Vec) -> ChainProcess {
use mingling_core::AnyOutput;
AnyOutput::new(CompletionContext { inner: args }).route_chain()
}
-
- fn clone_dispatcher(&self) -> Box> {
- todo!()
- }
}
// SAFETY: These implementations are provided for demonstration purposes only.
diff --git a/mingling/src/lib.rs b/mingling/src/lib.rs
index 9d38a2a..3707289 100644
--- a/mingling/src/lib.rs
+++ b/mingling/src/lib.rs
@@ -88,7 +88,6 @@ pub mod macros {
pub use mingling_macros::help;
pub use mingling_macros::metadata;
pub use mingling_macros::mlint;
- pub use mingling_macros::node;
pub use mingling_macros::pack;
#[cfg(feature = "extras")]
pub use mingling_macros::pack_err;
diff --git a/mingling_cli/src/linter/cmd_lint.rs b/mingling_cli/src/linter/cmd_lint.rs
index 38f2973..07c18c5 100644
--- a/mingling_cli/src/linter/cmd_lint.rs
+++ b/mingling_cli/src/linter/cmd_lint.rs
@@ -8,7 +8,7 @@ use mingling::picker::{EntryPicker, PickerArg};
use mingling::{LazyRes, ShellContext, Suggest};
use tokio::task::JoinSet;
-dispatcher!("lint", CMDLint => EntryLint);
+dispatcher!("lint", EntryLint);
const ARG_WITH_CHECKER: PickerArg