aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-05 23:06:39 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-05 23:06:39 +0800
commitbdf9eb3ffce9076f76ec29079c9977eb6dcda8e5 (patch)
treed1c5b314f2971e8c0a4c485f4846d20bcfe7f8c2
parent8c9af7e7f402ca34adf88d6a5f9b2a562ee3b3b5 (diff)
Add verbose and dry_run fields as convention-only options
-rw-r--r--CHANGELOG.md2
-rw-r--r--mingling_core/src/program/config.rs20
2 files changed, 19 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55dbfce..91de864 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -37,6 +37,8 @@ program.with_setup(ConfirmFlagSetup::new(["-C", "--confirm"]));
program.with_setup(BasicProgramSetup);
```
+3. **\[core\]** Added `verbose` option to `ProgramStdoutSetting` and `dry_run` option to `ProgramUserContext`. These fields are annotated as conventions only, meaning the framework does not enforce any particular behavior — it is up to the application to read and act on them.
+
#### **BREAKING CHANGES** (API CHANGES):
1. **\[core\]** Changed the signature of `ProgramSetup::setup` from `fn setup(&mut self, program: &mut Program<C>) -> S` to `fn setup(self, program: &mut Program<C>)`, consuming `self` instead of taking a mutable reference. Correspondingly, `Program::with_setup` now accepts `S` by value (`&mut self, setup: S`) instead of by mutable reference (`&mut self, setup: &mut S`).
diff --git a/mingling_core/src/program/config.rs b/mingling_core/src/program/config.rs
index 5c104ab..4cca52f 100644
--- a/mingling_core/src/program/config.rs
+++ b/mingling_core/src/program/config.rs
@@ -10,6 +10,11 @@ pub struct ProgramStdoutSetting {
/// Silence panic messages
pub silence_panic: bool,
+ /// Verbose output: provide detailed information
+ ///
+ /// **NOTE**: Convention only, not a configuration
+ pub verbose: bool,
+
#[cfg(feature = "clap")]
/// Behavior when Clap Dispatcher outputs help information
pub clap_help_print_behaviour: ClapHelpPrintBehaviour,
@@ -32,6 +37,7 @@ impl Default for ProgramStdoutSetting {
error_output: true,
render_output: true,
silence_panic: false,
+ verbose: false,
#[cfg(feature = "clap")]
clap_help_print_behaviour: ClapHelpPrintBehaviour::default(),
}
@@ -44,19 +50,27 @@ pub struct ProgramUserContext {
/// View help information instead of running the command
pub help: bool,
+ /// Execute hooks during the program lifecycle
+ pub run_hook: bool,
+
/// Skip user confirmation step
+ ///
+ /// **NOTE**: Convention only, not a configuration
pub confirm: bool,
- /// Execute hooks during the program lifecycle
- pub run_hook: bool,
+ /// Dry-run mode: simulate actions without making changes
+ ///
+ /// **NOTE**: Convention only, not a configuration
+ pub dry_run: bool,
}
impl Default for ProgramUserContext {
fn default() -> Self {
Self {
help: false,
- confirm: false,
run_hook: true,
+ confirm: false,
+ dry_run: false,
}
}
}