From 517082bbed049441a75666eb09b12cd8252a1edd Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Tue, 28 Apr 2026 18:00:27 +0800 Subject: Remove implicit help print and add version flag --- mling/src/cli.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mling/src/cli.rs') diff --git a/mling/src/cli.rs b/mling/src/cli.rs index 65ba02a..465d813 100644 --- a/mling/src/cli.rs +++ b/mling/src/cli.rs @@ -20,12 +20,6 @@ pub mod install; pub use install::*; pub fn cli_entry() { - // Facade - if std::env::args().len() == 1 { - println!("{}", include_str!("../res/guide.txt").trim_end()); - return; - } - let mut program = ThisProgram::new(); // Plugins @@ -33,6 +27,11 @@ pub fn cli_entry() { program.with_setup(GeneralRendererSetup); program.with_dispatcher(CompletionDispatcher); + if program.pick_global_flag(["-v", "--version"]) { + println!("{}", include_str!("../res/version.txt").trim_end()); + return; + } + // Help if program.user_context.help { println!( -- cgit