diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-04-28 18:00:27 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-04-28 18:00:27 +0800 |
| commit | 517082bbed049441a75666eb09b12cd8252a1edd (patch) | |
| tree | 840ba1a6ea9748495912673555a23118b61ba7d2 | |
| parent | 5aa9bcb7e92bb344f86ac595ebcf0aa6c80dee9d (diff) | |
Remove implicit help print and add version flag
| -rw-r--r-- | mling/res/version.txt (renamed from mling/res/guide.txt) | 0 | ||||
| -rw-r--r-- | mling/src/cli.rs | 11 |
2 files changed, 5 insertions, 6 deletions
diff --git a/mling/res/guide.txt b/mling/res/version.txt index b1548c8..b1548c8 100644 --- a/mling/res/guide.txt +++ b/mling/res/version.txt 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!( |
