forge
Explore
Log in

Don't you dare go Hollow

Print git version in clap too

Browse files at this commit

65e864965ec6e4a08a8e6696f779a5734033b6beIvan MolodetskikhParent: 55ad36a
Cargo.tomlmodified+1 -1
@@ -41,7 +41,7 @@ async-channel = { version = "2.1.1", optional = true }
41 async-io = { version = "1.13.0", optional = true }41 async-io = { version = "1.13.0", optional = true }
42 bitflags = "2.4.2"42 bitflags = "2.4.2"
43 calloop = { version = "0.12.4", features = ["executor", "futures-io"] }43 calloop = { version = "0.12.4", features = ["executor", "futures-io"] }
44-clap = { version = "4.4.18", features = ["derive"] }44+clap = { version = "4.4.18", features = ["derive", "string"] }
45 directories = "5.0.1"45 directories = "5.0.1"
46 futures-util = { version = "0.3.30", default-features = false, features = ["std", "io"] }46 futures-util = { version = "0.3.30", default-features = false, features = ["std", "io"] }
47 git-version = "0.3.9"47 git-version = "0.3.9"
src/main.rsmodified+10 -6
@@ -49,7 +49,7 @@ use crate::ipc::client::handle_msg;
49 use crate::utils::{cause_panic, REMOVE_ENV_RUST_BACKTRACE, REMOVE_ENV_RUST_LIB_BACKTRACE};49 use crate::utils::{cause_panic, REMOVE_ENV_RUST_BACKTRACE, REMOVE_ENV_RUST_LIB_BACKTRACE};
50 50
51 #[derive(Parser)]51 #[derive(Parser)]
52-#[command(author, version, about, long_about = None)]52+#[command(author, version = version(), about, long_about = None)]
53 #[command(args_conflicts_with_subcommands = true)]53 #[command(args_conflicts_with_subcommands = true)]
54 #[command(subcommand_value_name = "SUBCOMMAND")]54 #[command(subcommand_value_name = "SUBCOMMAND")]
55 #[command(subcommand_help_heading = "Subcommands")]55 #[command(subcommand_help_heading = "Subcommands")]
@@ -151,11 +151,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
151 }151 }
152 }152 }
153 153
154- info!(154+ info!("starting version {}", &version());
155- "starting version {} ({})",
156- env!("CARGO_PKG_VERSION"),
157- git_version!(fallback = "unknown commit"),
158- );
159 155
160 // Load the config.156 // Load the config.
161 let path = cli.config.or_else(default_config_path);157 let path = cli.config.or_else(default_config_path);
@@ -257,6 +253,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
257 Ok(())253 Ok(())
258 }254 }
259 255
256+fn version() -> String {
257+ format!(
258+ "{} ({})",
259+ env!("CARGO_PKG_VERSION"),
260+ git_version!(fallback = "unknown commit"),
261+ )
262+}
263+
260 fn import_env_to_systemd() {264 fn import_env_to_systemd() {
261 let rv = Command::new("/bin/sh")265 let rv = Command::new("/bin/sh")
262 .args([266 .args([