feat: Add -V/--version flag to print version string

Closes #156

- Add handling for -V and --version arguments in CLI parser
- Print version to stdout using CARGO_PKG_VERSION from Cargo.toml
- Update help text to include version option
This commit is contained in:
Vladislav Yaroslavlev 2026-02-19 10:23:49 +03:00
parent 301f829c3c
commit f31d9d42fe
No known key found for this signature in database
GPG Key ID: E74236290ADCDDCD
1 changed files with 5 additions and 0 deletions

View File

@ -74,6 +74,7 @@ fn parse_cli() -> (String, bool, Option<String>) {
eprintln!("Options:");
eprintln!(" --silent, -s Suppress info logs");
eprintln!(" --log-level <LEVEL> debug|verbose|normal|silent");
eprintln!(" --version, -V Print version information");
eprintln!(" --help, -h Show this help");
eprintln!();
eprintln!("Setup (fire-and-forget):");
@ -92,6 +93,10 @@ fn parse_cli() -> (String, bool, Option<String>) {
eprintln!(" --no-start Don't start the service after install");
std::process::exit(0);
}
"--version" | "-V" => {
println!("telemt {}", env!("CARGO_PKG_VERSION"));
std::process::exit(0);
}
s if !s.starts_with('-') => {
config_path = s.to_string();
}