feat: print version with -v or --version

This commit is contained in:
Tobias Berger 2024-02-05 21:22:40 +01:00
parent eb5d8b8940
commit b9108c29b2
Signed by: toby
GPG key ID: 2D05EFAB764D6A88
2 changed files with 7 additions and 1 deletions

View file

@ -1,7 +1,7 @@
[package] [package]
name = "todoodoo" name = "todoodoo"
description = "todoodoo" description = "todoodoo"
version = "0.2.0" version = "0.2.1"
edition = "2021" edition = "2021"
license = "GPL-3.0-only" license = "GPL-3.0-only"

View file

@ -40,6 +40,12 @@ impl Display for RunError {
impl Error for RunError {} impl Error for RunError {}
fn main() -> Result<(), RunError> { fn main() -> Result<(), RunError> {
for argument in std::env::args() {
if argument == "-v" || argument == "--version" {
println!("CARGO_PKG_VERSION");
return Ok(());
}
}
std::env::set_var("WINIT_UNIX_BACKEND", "wayland"); std::env::set_var("WINIT_UNIX_BACKEND", "wayland");
let home_dir = homedir::get_my_home() let home_dir = homedir::get_my_home()
.map_err(RunError::HomeDir)? .map_err(RunError::HomeDir)?