diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-08-07 12:59:16 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-07 16:57:24 +0800 |
| commit | 9daff4936ed04f7bab247a2eb741e03d6a39c209 (patch) | |
| tree | 860b3275091a7e209d456b31f0a1566499676711 /mingling_cli/src/bin | |
| parent | 32ee3596042cc4e723afd30b87298a13feef7c24 (diff) | |
refactor(cli): move global help and completion to library
Move the global help and completion handlers from the CLI binary
into the library crate so they can be reused by other entry points.
Diffstat (limited to 'mingling_cli/src/bin')
| -rw-r--r-- | mingling_cli/src/bin/cli.rs | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/mingling_cli/src/bin/cli.rs b/mingling_cli/src/bin/cli.rs index 28362e0..fe2e60a 100644 --- a/mingling_cli/src/bin/cli.rs +++ b/mingling_cli/src/bin/cli.rs @@ -1,20 +1,6 @@ -use mingling::{ - ShellContext, Suggest, - consts::HELP_FLAG, - macros::{completion, help, suggest}, - setup::{ExitCodeSetup, picker::HelpFlagSetup}, -}; +use mingling::setup::{ExitCodeSetup, picker::HelpFlagSetup}; use mingling_cli::{ - EntryFallback, ThisProgram, - linter::registry::LintRegistrySetup, - metadata::{ - MinglingMetadataSetup, - setup::{ - ARG_ALL_FEATURES, ARG_FEATURES, ARG_MANIFEST_PATH, ARG_MESSAGE_FORMAT, - ARG_NO_DEFAULT_FEATURES, ARG_NO_DEPS, - }, - }, - utils::display::ColorCode, + ThisProgram, linter::registry::LintRegistrySetup, metadata::MinglingMetadataSetup, }; #[tokio::main] @@ -31,21 +17,3 @@ async fn main() { // Exec program.exec_and_exit().await; } - -#[help] -pub fn help_global(_: EntryFallback) -> String { - include_str!("../../help/help.txt").parse_color_code() -} - -#[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", - } -} |
