diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-03-28 00:47:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-03-28 00:47:46 +0800 |
| commit | 7ce68cd11516bd7cf037ecea99a92aee7c31b2c3 (patch) | |
| tree | a3923ad41c91aa21fe169fd6b4b1bf8898a82589 /mingling/src/program/setup | |
Add initial Mingling framework codebase
Diffstat (limited to 'mingling/src/program/setup')
| -rw-r--r-- | mingling/src/program/setup/basic.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/mingling/src/program/setup/basic.rs b/mingling/src/program/setup/basic.rs new file mode 100644 index 0000000..0ea72a6 --- /dev/null +++ b/mingling/src/program/setup/basic.rs @@ -0,0 +1,25 @@ +use crate::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 ProgramSetup for BasicProgramSetup { + fn setup(program: &mut Program) { + 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; + }); + } +} |
