summaryrefslogtreecommitdiff
path: root/rola-cli/src/lib.rs
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-06-18 05:04:21 +0800
committer魏曹先生 <1992414357@qq.com>2026-06-18 05:04:21 +0800
commit961ee2eb342259398916dfe7458098f7c9297c11 (patch)
treee8b3f2aa4cbd3afc8ce9da9751c4c0ad483f4273 /rola-cli/src/lib.rs
parent133ab48d0d9ac1d0f8ad87b7a71b8e6cd4f7d402 (diff)
feat: add build script for version info and shell completions
Introduce a build.rs that generates a version.txt file with the package version, git commit hash, and date. Also generate shell completion scripts using mingling's build utilities. Migrate the `-v/--version` flag to read from the generated version.txt and replace BasicProgramSetup with HelpFlagSetup.
Diffstat (limited to 'rola-cli/src/lib.rs')
-rw-r--r--rola-cli/src/lib.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/rola-cli/src/lib.rs b/rola-cli/src/lib.rs
index f81c34e..54ff09a 100644
--- a/rola-cli/src/lib.rs
+++ b/rola-cli/src/lib.rs
@@ -1,4 +1,6 @@
-use mingling::macros::gen_program;
+use std::process::exit;
+
+use mingling::macros::{gen_program, help};
pub mod res;
pub mod tokio_wrapper;
@@ -9,6 +11,15 @@ use bucket_mgr::*;
mod error;
use error::*;
+#[help]
+fn handle_error_dispatch_not_found(_err: ErrorDispatcherNotFound) {
+ let help = locale::helps::Basic::help().trim();
+
+ // Print directly to stderr and exit with code 0
+ eprintln!("{}", help);
+ exit(0)
+}
+
gen_program!();
pub mod locale {