aboutsummaryrefslogtreecommitdiff
path: root/mingling
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-14 17:47:15 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-14 18:02:09 +0800
commit9c8fe13c2629a4318bd12815c07cef1371ba85a2 (patch)
tree9e9af625832a1f872f5523dbf9d9730af0ef90c8 /mingling
parentf3c134615c56dc7372e47a216dddca72250a3308 (diff)
feat(core): move config types to public config module
Refactor program configuration types into a dedicated public `config` module under `mingling_core`, making `StructuralRendererSetting` accessible via `mingling_core::config` instead of the crate root. Update all internal references and setup modules to use the new `config::` path convention.
Diffstat (limited to 'mingling')
-rw-r--r--mingling/src/example_docs.rs6
-rw-r--r--mingling/src/gen_program.rs2
-rw-r--r--mingling/src/setups/basic.rs7
-rw-r--r--mingling/src/setups/picker/basic.rs5
-rw-r--r--mingling/src/setups/picker/structural_renderer.rs12
-rw-r--r--mingling/src/setups/structural_renderer.rs12
6 files changed, 23 insertions, 21 deletions
diff --git a/mingling/src/example_docs.rs b/mingling/src/example_docs.rs
index fb0a6fc..55aabdf 100644
--- a/mingling/src/example_docs.rs
+++ b/mingling/src/example_docs.rs
@@ -635,8 +635,8 @@ pub mod example_basic {}
///
/// // Set clap help output mode
/// program.stdout_setting.clap_help_print_behaviour =
-/// mingling::ClapHelpPrintBehaviour::WriteToRenderResult;
-/// // mingling::ClapHelpPrintBehaviour::PrintDirectly
+/// mingling::config::ClapHelpPrintBehaviour::WriteToRenderResult;
+/// // mingling::config::ClapHelpPrintBehaviour::PrintDirectly
/// //
/// // PrintDirectly:
/// // Let Clap print help information directly to stdout
@@ -2472,7 +2472,7 @@ pub mod example_pack_err {}
///
/// Source code (./src/main.rs)
/// ```ignore
-/// use mingling::PanicSilence;
+/// use mingling::config::PanicSilence;
/// use mingling::{hook::ProgramHook, prelude::*};
/// use std::io::Write;
///
diff --git a/mingling/src/gen_program.rs b/mingling/src/gen_program.rs
index fbced64..6a0b144 100644
--- a/mingling/src/gen_program.rs
+++ b/mingling/src/gen_program.rs
@@ -253,7 +253,7 @@ impl ProgramCollect for ThisProgram {
#[cfg(feature = "structural_renderer")]
fn structural_render(
_any: mingling_core::AnyOutput<Self::Enum>,
- _setting: &mingling_core::StructuralRendererSetting,
+ _setting: &mingling_core::config::StructuralRendererSetting,
) -> Result<mingling_core::RenderResult, mingling_core::error::StructuralRendererSerializeError>
{
todo!()
diff --git a/mingling/src/setups/basic.rs b/mingling/src/setups/basic.rs
index 0d41d14..e2246e0 100644
--- a/mingling/src/setups/basic.rs
+++ b/mingling/src/setups/basic.rs
@@ -2,7 +2,8 @@
#![allow(deprecated)]
use mingling_core::{
- ConfirmationMode, Flag, InteractionMode, Program, ProgramCollect, YesAssumption,
+ Flag, Program, ProgramCollect,
+ config::{ConfirmationMode, ErrorOutput, InteractionMode, RenderOutput, YesAssumption},
setup::ProgramSetup,
};
@@ -95,8 +96,8 @@ where
{
fn setup(self, program: &mut Program<C>) {
program.global_flag(self.flag, |p| {
- p.stdout_setting.render_output = mingling_core::RenderOutput::Hide;
- p.stdout_setting.error_output = mingling_core::ErrorOutput::Hide;
+ p.stdout_setting.render_output = RenderOutput::Hide;
+ p.stdout_setting.error_output = ErrorOutput::Hide;
});
}
}
diff --git a/mingling/src/setups/picker/basic.rs b/mingling/src/setups/picker/basic.rs
index 438ed40..76b7857 100644
--- a/mingling/src/setups/picker/basic.rs
+++ b/mingling/src/setups/picker/basic.rs
@@ -1,8 +1,9 @@
// Doc Not Optimize
use arg_picker::{PickerArg, value::Flag};
use mingling_core::{
- ConfirmationMode, ErrorOutput, InteractionMode, Program, ProgramCollect, RenderOutput,
- YesAssumption, setup::ProgramSetup,
+ Program, ProgramCollect,
+ config::{ConfirmationMode, ErrorOutput, InteractionMode, RenderOutput, YesAssumption},
+ setup::ProgramSetup,
};
use crate::{
diff --git a/mingling/src/setups/picker/structural_renderer.rs b/mingling/src/setups/picker/structural_renderer.rs
index bd9b401..998fa16 100644
--- a/mingling/src/setups/picker/structural_renderer.rs
+++ b/mingling/src/setups/picker/structural_renderer.rs
@@ -48,27 +48,27 @@ where
fn setup(self, program: &mut Program<C>) {
#[cfg(feature = "json_serde_fmt")]
if program.pick_flag(&crate::consts::JSON_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::Json;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::Json;
}
#[cfg(feature = "json_serde_fmt")]
if program.pick_flag(&crate::consts::JSON_PRETTY_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::JsonPretty;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::JsonPretty;
}
#[cfg(feature = "yaml_serde_fmt")]
if program.pick_flag(&crate::consts::YAML_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::Yaml;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::Yaml;
}
#[cfg(feature = "toml_serde_fmt")]
if program.pick_flag(&crate::consts::TOML_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::Toml;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::Toml;
}
#[cfg(feature = "ron_serde_fmt")]
if program.pick_flag(&crate::consts::RON_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::Ron;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::Ron;
}
#[cfg(feature = "ron_serde_fmt")]
if program.pick_flag(&crate::consts::RON_PRETTY_FLAG) {
- program.structural_renderer_name = crate::StructuralRendererSetting::RonPretty;
+ program.structural_renderer_name = crate::config::StructuralRendererSetting::RonPretty;
}
}
}
diff --git a/mingling/src/setups/structural_renderer.rs b/mingling/src/setups/structural_renderer.rs
index d6f45b7..6580c57 100644
--- a/mingling/src/setups/structural_renderer.rs
+++ b/mingling/src/setups/structural_renderer.rs
@@ -50,27 +50,27 @@ where
fn setup(self, program: &mut Program<C>) {
#[cfg(feature = "json_serde_fmt")]
program.global_flag("--json", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::Json;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::Json;
});
#[cfg(feature = "json_serde_fmt")]
program.global_flag("--json-pretty", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::JsonPretty;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::JsonPretty;
});
#[cfg(feature = "yaml_serde_fmt")]
program.global_flag("--yaml", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::Yaml;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::Yaml;
});
#[cfg(feature = "toml_serde_fmt")]
program.global_flag("--toml", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::Toml;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::Toml;
});
#[cfg(feature = "ron_serde_fmt")]
program.global_flag("--ron", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::Ron;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::Ron;
});
#[cfg(feature = "ron_serde_fmt")]
program.global_flag("--ron-pretty", |p| {
- p.structural_renderer_name = crate::StructuralRendererSetting::RonPretty;
+ p.structural_renderer_name = crate::config::StructuralRendererSetting::RonPretty;
});
}
}