diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-26 01:23:39 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-26 01:23:39 +0800 |
| commit | d2c44d5c1cd8df2d150c849e8bd196e15c4015e3 (patch) | |
| tree | 824a2282c8c10923651e76d2c27956e0390ab6fd /mingling_core | |
| parent | 00923e2a4180c39ccc2d0ab51a7548fb7bfa5719 (diff) | |
Add clap_parser feature to mingling_core with help output behavior
config
Diffstat (limited to 'mingling_core')
| -rw-r--r-- | mingling_core/Cargo.toml | 1 | ||||
| -rw-r--r-- | mingling_core/src/program/config.rs | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/mingling_core/Cargo.toml b/mingling_core/Cargo.toml index b6846e7..b13d3d3 100644 --- a/mingling_core/Cargo.toml +++ b/mingling_core/Cargo.toml @@ -12,6 +12,7 @@ async = [] full = ["comp", "general_renderer"] +clap_parser = [] comp = ["dep:just_template"] debug = ["dep:log", "dep:env_logger"] general_renderer = [ diff --git a/mingling_core/src/program/config.rs b/mingling_core/src/program/config.rs index 2f5de4c..78c6185 100644 --- a/mingling_core/src/program/config.rs +++ b/mingling_core/src/program/config.rs @@ -6,6 +6,21 @@ pub struct ProgramStdoutSetting { /// Render results and output pub render_output: bool, + + #[cfg(feature = "clap_parser")] + /// Behavior when Clap Dispatcher outputs help information + pub clap_help_print_behaviour: ClapHelpPrintBehaviour, +} + +#[cfg(feature = "clap_parser")] +#[derive(Debug, Default, Clone)] +pub enum ClapHelpPrintBehaviour { + /// Write to RenderResult + WriteToRenderResult, + + /// Print directly + #[default] + PrintDirectly, } impl Default for ProgramStdoutSetting { @@ -13,6 +28,8 @@ impl Default for ProgramStdoutSetting { ProgramStdoutSetting { error_output: true, render_output: true, + #[cfg(feature = "clap_parser")] + clap_help_print_behaviour: ClapHelpPrintBehaviour::default(), } } } |
