diff options
Diffstat (limited to 'mingling/src/setups/picker')
| -rw-r--r-- | mingling/src/setups/picker/basic.rs | 8 | ||||
| -rw-r--r-- | mingling/src/setups/picker/structural_renderer.rs | 19 |
2 files changed, 12 insertions, 15 deletions
diff --git a/mingling/src/setups/picker/basic.rs b/mingling/src/setups/picker/basic.rs index c9f82b3..52bda3d 100644 --- a/mingling/src/setups/picker/basic.rs +++ b/mingling/src/setups/picker/basic.rs @@ -3,7 +3,7 @@ use mingling_core::{Program, ProgramCollect, setup::ProgramSetup}; use crate::{ consts::{CONFIRM_FLAG, HELP_FLAG, QUIET_FLAG}, - picker::pick_global_flag, + picker::PickerHelper, }; /// Performs basic program initialization: @@ -43,7 +43,7 @@ where C: ProgramCollect<Enum = C>, { fn setup(self, program: &mut Program<C>) { - let help = pick_global_flag(program, self.flag); + let help = program.pick_flag(self.flag); if help { program.user_context.help = true; } @@ -75,7 +75,7 @@ where C: ProgramCollect<Enum = C>, { fn setup(self, program: &mut Program<C>) { - let help = pick_global_flag(program, self.flag); + let help = program.pick_flag(self.flag); if help { program.stdout_setting.quiet = true; } @@ -107,7 +107,7 @@ where C: ProgramCollect<Enum = C>, { fn setup(self, program: &mut Program<C>) { - let help = pick_global_flag(program, self.flag); + let help = program.pick_flag(self.flag); if help { program.user_context.confirm = true; } diff --git a/mingling/src/setups/picker/structural_renderer.rs b/mingling/src/setups/picker/structural_renderer.rs index 1fa48fd..91848e4 100644 --- a/mingling/src/setups/picker/structural_renderer.rs +++ b/mingling/src/setups/picker/structural_renderer.rs @@ -1,9 +1,6 @@ use mingling_core::{Program, ProgramCollect, setup::ProgramSetup}; -use crate::{ - consts::RENDERER_ARG, - picker::{pick_global_argument, pick_global_flag}, -}; +use crate::{consts::RENDERER_ARG, picker::PickerHelper}; /// Sets up the structural renderer for the program: /// @@ -15,7 +12,7 @@ where C: ProgramCollect<Enum = C>, { fn setup(self, program: &mut Program<C>) { - if let Some(renderer) = pick_global_argument(program, &RENDERER_ARG) { + if let Some(renderer) = program.pick_argument(&RENDERER_ARG) { program.structural_renderer_name = renderer.into(); } } @@ -49,27 +46,27 @@ where { fn setup(self, program: &mut Program<C>) { #[cfg(feature = "json_serde_fmt")] - if pick_global_flag(program, &crate::consts::JSON_FLAG) { + if program.pick_flag(&crate::consts::JSON_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Json; } #[cfg(feature = "json_serde_fmt")] - if pick_global_flag(program, &crate::consts::JSON_PRETTY_FLAG) { + if program.pick_flag(&crate::consts::JSON_PRETTY_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::JsonPretty; } #[cfg(feature = "yaml_serde_fmt")] - if pick_global_flag(program, &crate::consts::YAML_FLAG) { + if program.pick_flag(&crate::consts::YAML_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Yaml; } #[cfg(feature = "toml_serde_fmt")] - if pick_global_flag(program, &crate::consts::TOML_FLAG) { + if program.pick_flag(&crate::consts::TOML_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Toml; } #[cfg(feature = "ron_serde_fmt")] - if pick_global_flag(program, &crate::consts::RON_FLAG) { + if program.pick_flag(&crate::consts::RON_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::Ron; } #[cfg(feature = "ron_serde_fmt")] - if pick_global_flag(program, &crate::consts::RON_PRETTY_FLAG) { + if program.pick_flag(&crate::consts::RON_PRETTY_FLAG) { program.structural_renderer_name = crate::StructuralRendererSetting::RonPretty; } } |
