diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-29 21:48:23 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-29 21:48:23 +0800 |
| commit | 596e5e2440df2d32f1cf3e052dc633e774edf6ee (patch) | |
| tree | dc98eb6a1789847b899207d0b99337bb3ccd92a5 /mingling_core/src/program/setup/basic.rs | |
| parent | 25a164f74c011e6e78846f226cbd7a8bd87db92f (diff) | |
Rename mingling to mingling_core and update dependencies
Diffstat (limited to 'mingling_core/src/program/setup/basic.rs')
| -rw-r--r-- | mingling_core/src/program/setup/basic.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/mingling_core/src/program/setup/basic.rs b/mingling_core/src/program/setup/basic.rs new file mode 100644 index 0000000..43c14b9 --- /dev/null +++ b/mingling_core/src/program/setup/basic.rs @@ -0,0 +1,31 @@ +use crate::{ + ProgramCollect, + program::{Program, setup::ProgramSetup}, +}; + +/// Performs basic program initialization: +/// +/// - Collects `--quiet` flag to control message rendering +/// - Collects `--help` flag to enable help mode +/// - Collects `--confirm` flag to skip user confirmation +pub struct BasicProgramSetup; + +impl<C> ProgramSetup<C> for BasicProgramSetup +where + C: ProgramCollect, +{ + fn setup(&mut self, program: &mut Program<C>) { + program.global_flag(["--quiet", "-q"], |p| { + p.stdout_setting.render_output = false; + p.stdout_setting.error_output = false; + }); + + program.global_flag(["--help", "-h"], |p| { + p.user_context.help = true; + }); + + program.global_flag(["--confirm", "-C"], |p| { + p.user_context.confirm = true; + }); + } +} |
