From 6a907b71f945bf49d27a001f279bf116ad7297d8 Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 28 Apr 2026 16:27:10 +0800 Subject: Rename refresh command to install --- mling/src/cli/install.rs | 32 ++++++++++++++++++++++++++++++++ mling/src/cli/refresh.rs | 32 -------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) create mode 100644 mling/src/cli/install.rs delete mode 100644 mling/src/cli/refresh.rs (limited to 'mling/src/cli') diff --git a/mling/src/cli/install.rs b/mling/src/cli/install.rs new file mode 100644 index 0000000..dc2cf57 --- /dev/null +++ b/mling/src/cli/install.rs @@ -0,0 +1,32 @@ +use mingling::{ + ShellContext, Suggest, + macros::{chain, completion, dispatcher, pack, suggest}, + parser::Picker, +}; + +use crate::{ThisProgram, project_installer::install_all}; + +dispatcher!("install", InstallCommand => InstallEntry); + +pack!(ResultInstallCompleted = ()); + +#[completion(InstallEntry)] +pub(crate) fn comp_install(ctx: &ShellContext) -> Suggest { + if ctx.typing_argument() { + return suggest! { + "--clean": "Clean build artifacts before installation", + "-c": "Clean build artifacts before installation", + }; + } + return suggest!(); +} + +#[chain] +pub(crate) fn handle_install_entry(prev: InstallEntry) -> NextProcess { + let is_clean_before_build = Picker::new(prev.inner) + .pick::(["--clean", "-c"]) + .unpack(); + let _ = install_all(is_clean_before_build); + + ResultInstallCompleted::new(()) +} diff --git a/mling/src/cli/refresh.rs b/mling/src/cli/refresh.rs deleted file mode 100644 index 368670e..0000000 --- a/mling/src/cli/refresh.rs +++ /dev/null @@ -1,32 +0,0 @@ -use mingling::{ - ShellContext, Suggest, - macros::{chain, completion, dispatcher, pack, suggest}, - parser::Picker, -}; - -use crate::{ThisProgram, project_installer::install_all}; - -dispatcher!("refresh", RefreshCommand => RefreshEntry); - -pack!(ResultRefreshCompleted = ()); - -#[completion(RefreshEntry)] -pub(crate) fn comp_refresh(ctx: &ShellContext) -> Suggest { - if ctx.typing_argument() { - return suggest! { - "--clean": "Clean build artifacts before installation", - "-c": "Clean build artifacts before installation", - }; - } - return suggest!(); -} - -#[chain] -pub(crate) fn handle_refresh_entry(prev: RefreshEntry) -> NextProcess { - let is_clean_before_build = Picker::new(prev.inner) - .pick::(["--clean", "-c"]) - .unpack(); - let _ = install_all(is_clean_before_build); - - ResultRefreshCompleted::new(()) -} -- cgit