diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-07 12:52:46 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-07 16:57:24 +0800 |
| commit | 32ee3596042cc4e723afd30b87298a13feef7c24 (patch) | |
| tree | 5d3bec726b5f93cc5a0e3f36ea76dd13ef2ec1ce /mingling_cli | |
| parent | b5e88fe3b188bf5fa50d022714863f018550ed8b (diff) | |
chore: move CLI entry to bin and restructure imports
Move the CLI binary from `src/main.rs` to `src/bin/cli.rs`
and move shared program generation into a new lib.rs module.
Diffstat (limited to 'mingling_cli')
| -rw-r--r-- | mingling_cli/Cargo.toml | 2 | ||||
| -rw-r--r-- | mingling_cli/src/bin/cli.rs (renamed from mingling_cli/src/main.rs) | 30 | ||||
| -rw-r--r-- | mingling_cli/src/lib.rs | 13 |
3 files changed, 24 insertions, 21 deletions
diff --git a/mingling_cli/Cargo.toml b/mingling_cli/Cargo.toml index c52eefd..94b0c69 100644 --- a/mingling_cli/Cargo.toml +++ b/mingling_cli/Cargo.toml @@ -17,7 +17,7 @@ path = "src/bin/wrapper.rs" [[bin]] name = "mingling-cli" -path = "src/main.rs" +path = "src/bin/cli.rs" [dependencies.mingling] path = "../mingling" diff --git a/mingling_cli/src/main.rs b/mingling_cli/src/bin/cli.rs index 324118b..28362e0 100644 --- a/mingling_cli/src/main.rs +++ b/mingling_cli/src/bin/cli.rs @@ -1,4 +1,11 @@ -use crate::{ +use mingling::{ + ShellContext, Suggest, + consts::HELP_FLAG, + macros::{completion, help, suggest}, + setup::{ExitCodeSetup, picker::HelpFlagSetup}, +}; +use mingling_cli::{ + EntryFallback, ThisProgram, linter::registry::LintRegistrySetup, metadata::{ MinglingMetadataSetup, @@ -7,23 +14,8 @@ use crate::{ ARG_NO_DEFAULT_FEATURES, ARG_NO_DEPS, }, }, + utils::display::ColorCode, }; -use mingling::{ - ShellContext, Suggest, - consts::HELP_FLAG, - macros::{completion, gen_program, help, suggest}, - setup::{ExitCodeSetup, picker::HelpFlagSetup}, -}; - -pub mod diagnostic; -pub mod errors; -pub mod linter; -pub mod lints; -pub mod message; -pub mod metadata; -pub mod pkg_mgr; -pub mod proj_mgr; -pub mod utils; #[tokio::main] async fn main() { @@ -42,7 +34,7 @@ async fn main() { #[help] pub fn help_global(_: EntryFallback) -> String { - include_str!("../help/help.txt").to_string() + include_str!("../../help/help.txt").parse_color_code() } #[completion(EntryFallback)] @@ -57,5 +49,3 @@ pub fn complete_global(_ctx: &ShellContext) -> Suggest { ARG_NO_DEPS: "Do not include dependencies in metadata", } } - -gen_program!(); diff --git a/mingling_cli/src/lib.rs b/mingling_cli/src/lib.rs new file mode 100644 index 0000000..8b25612 --- /dev/null +++ b/mingling_cli/src/lib.rs @@ -0,0 +1,13 @@ +use mingling::macros::gen_program; + +pub mod diagnostic; +pub mod errors; +pub mod linter; +pub mod lints; +pub mod message; +pub mod metadata; +pub mod pkg_mgr; +pub mod proj_mgr; +pub mod utils; + +gen_program!(); |
