From 615173c7b598f307e9d156a84e70d56b18c40d71 Mon Sep 17 00:00:00 2001 From: Filip Schauer Date: Tue, 26 Nov 2024 14:17:51 +0100 Subject: [PATCH] Add missing implementation of the --version option This was left in the help text but was not implemented during the transition from clap to picoargs in 80fb0a4a. Signed-off-by: Filip Schauer --- src/main.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.rs b/src/main.rs index f942a73..4f6691e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -65,6 +65,7 @@ Options: -V, --version Print version "; +const VERSION: &str = env!("CARGO_PKG_VERSION"); fn parse_args() -> Result { let mut args: Vec<_> = std::env::args_os().collect(); @@ -74,6 +75,8 @@ fn parse_args() -> Result { let options = [ "-h", "--help", + "-V", + "--version", "-c", "--compress", "-e", @@ -112,6 +115,9 @@ fn parse_args() -> Result { if args.contains(["-h", "--help"]) { print!("{CMD_HELP}"); std::process::exit(0); + } else if args.contains(["-V", "--version"]) { + println!("Version: {VERSION}"); + std::process::exit(0); } let pbs_repository = args.value_from_str("--repository")?;