diff options
Diffstat (limited to 'mingling_cli/src/lib.rs')
| -rw-r--r-- | mingling_cli/src/lib.rs | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/mingling_cli/src/lib.rs b/mingling_cli/src/lib.rs index 8b25612..524b74b 100644 --- a/mingling_cli/src/lib.rs +++ b/mingling_cli/src/lib.rs @@ -1,4 +1,16 @@ -use mingling::macros::gen_program; +use mingling::{ + ShellContext, Suggest, + consts::HELP_FLAG, + macros::{completion, gen_program, help, suggest}, +}; + +use crate::{ + metadata::setup::{ + ARG_ALL_FEATURES, ARG_FEATURES, ARG_MANIFEST_PATH, ARG_MESSAGE_FORMAT, + ARG_NO_DEFAULT_FEATURES, ARG_NO_DEPS, + }, + utils::display::ColorCode, +}; pub mod diagnostic; pub mod errors; @@ -10,4 +22,22 @@ pub mod pkg_mgr; pub mod proj_mgr; pub mod utils; +#[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", + } +} + gen_program!(); |
