From a80ac42e70c9194db91ebbfe9600db443e88ac5f Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Fri, 7 Aug 2026 12:52:46 +0800 Subject: 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. --- mingling_cli/src/main.rs | 61 ------------------------------------------------ 1 file changed, 61 deletions(-) delete mode 100644 mingling_cli/src/main.rs (limited to 'mingling_cli/src/main.rs') diff --git a/mingling_cli/src/main.rs b/mingling_cli/src/main.rs deleted file mode 100644 index 324118b..0000000 --- a/mingling_cli/src/main.rs +++ /dev/null @@ -1,61 +0,0 @@ -use crate::{ - linter::registry::LintRegistrySetup, - metadata::{ - MinglingMetadataSetup, - setup::{ - ARG_ALL_FEATURES, ARG_FEATURES, ARG_MANIFEST_PATH, ARG_MESSAGE_FORMAT, - ARG_NO_DEFAULT_FEATURES, ARG_NO_DEPS, - }, - }, -}; -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() { - let mut program = ThisProgram::new(); - - // Setups - program.with_setup(HelpFlagSetup::default()); - program.with_setup(ExitCodeSetup::default()); - - program.with_setup(MinglingMetadataSetup); - program.with_setup(LintRegistrySetup); - - // Exec - program.exec_and_exit().await; -} - -#[help] -pub fn help_global(_: EntryFallback) -> String { - include_str!("../help/help.txt").to_string() -} - -#[completion(EntryFallback)] -pub fn complete_global(_ctx: &ShellContext) -> Suggest { - suggest! { - HELP_FLAG: "Show help messages", - ARG_FEATURES.clone(): "List of features to enable", - ARG_MANIFEST_PATH.clone(): "Custom path to Cargo.toml", - ARG_MESSAGE_FORMAT.clone(): "Output message format", - ARG_ALL_FEATURES: "Enable all features", - ARG_NO_DEFAULT_FEATURES: "Disable default features", - ARG_NO_DEPS: "Do not include dependencies in metadata", - } -} - -gen_program!(); -- cgit