diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-06-07 15:40:53 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-06-07 15:40:53 +0800 |
| commit | 86647e7b5057826d7bb85381044d5b691fbbafa3 (patch) | |
| tree | 69a1768c3c8f571bfde426948bb58fe2e3e93bf2 /mling/src/lib.rs | |
| parent | 8aa276beb88086b866be8a446289106be237348a (diff) | |
Move error handling into its own module and add show.binaries command
Diffstat (limited to 'mling/src/lib.rs')
| -rw-r--r-- | mling/src/lib.rs | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/mling/src/lib.rs b/mling/src/lib.rs index add20ac..560380a 100644 --- a/mling/src/lib.rs +++ b/mling/src/lib.rs @@ -1,6 +1,5 @@ #![allow(unused_imports)] -use colored::Colorize; use mingling::{ macros::{chain, gen_program, pack, r_println, renderer}, res::ResExitCode, @@ -22,36 +21,4 @@ pub use proj_mgr::*; use crate::display::markdown; -pack!(ResultMlingHelp = ()); -pack!(ResultUnknownCommand = String); - -#[chain] -fn handle_error_dispatcher_not_found(err: ErrorDispatcherNotFound) -> Next { - if err.is_empty() { - ResultMlingHelp::default().to_render() - } else { - ResultUnknownCommand::new(err.join(" ")).to_render() - } -} - -#[renderer] -fn render_mling_help(_prev: ResultMlingHelp, ec: &mut ResExitCode) { - r_println!("{}", markdown(include_str!("helps/mling_help.txt"))); - ec.exit_code = 0; -} - -#[renderer] -fn render_unknown_command(prev: ResultUnknownCommand, ec: &mut ResExitCode) { - r_println!( - "{}", - eformat_cargo!("no such command: `{}`", prev.bright_yellow().bold()) - ); - r_println!(); - r_println!( - "{}", - hformat_cargo!("view all commands with `cargo help mling`") - ); - ec.exit_code = 101; -} - gen_program!(); |
