diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-19 01:40:38 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-19 01:40:38 +0800 |
| commit | 1e9c97c21f8a4e55420712b054895ff8b4f9a849 (patch) | |
| tree | c6bd37889deb54c024f974f368a9a7d654cad822 /rola-cli/src/lib.rs | |
| parent | e078163c7cdbbf226c18d3e3afa7268a2878e18b (diff) | |
Implement bucket bind CRUD operations and config loading, along with
CLI integration for listing, setting, and removing bucket bindings.
Diffstat (limited to 'rola-cli/src/lib.rs')
| -rw-r--r-- | rola-cli/src/lib.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/rola-cli/src/lib.rs b/rola-cli/src/lib.rs index b3587e2..b472169 100644 --- a/rola-cli/src/lib.rs +++ b/rola-cli/src/lib.rs @@ -1,6 +1,9 @@ use std::process::exit; -use mingling::macros::{gen_program, help}; +use mingling::{ + macros::{gen_program, help, r_println, renderer}, + res::ResExitCode, +}; pub mod output; pub mod res; @@ -14,8 +17,10 @@ use error::*; use crate::output::display::markdown; +pub const EC_COMMAND_NOT_FOUND: i32 = 1000; + #[help] -fn handle_error_dispatch_not_found(_err: ErrorDispatcherNotFound) { +fn help_global(_err: ErrorDispatcherNotFound) { let help = locale::helps::Basic::help().trim(); // Print directly to stderr and exit with code 0 @@ -23,6 +28,18 @@ fn handle_error_dispatch_not_found(_err: ErrorDispatcherNotFound) { exit(0) } +#[renderer] +fn render_error_dispatch_not_found(err: ErrorDispatcherNotFound, ec: &mut ResExitCode) { + if !err.inner.is_empty() { + let cmd_str = err.inner.join(" "); + r_println!( + "{}", + markdown(locale::errors::Common::command_not_found(cmd_str).trim()) + ); + ec.exit_code = EC_COMMAND_NOT_FOUND; + } +} + gen_program!(); pub mod locale { |
