aboutsummaryrefslogtreecommitdiff
path: root/mingling_cli/src/main.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-07 12:52:46 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-09 02:56:28 +0800
commita80ac42e70c9194db91ebbfe9600db443e88ac5f (patch)
tree0634fba28bb14aaf51d0cc41a7d996ce9433ca90 /mingling_cli/src/main.rs
parent60174972cd3053d96fc8f99e7b6c91e3b08577c9 (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/src/main.rs')
-rw-r--r--mingling_cli/src/main.rs61
1 files changed, 0 insertions, 61 deletions
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!();