From b9108c29b2fe97400e6ad0ea1909b13ae268610a Mon Sep 17 00:00:00 2001 From: Tobias Berger Date: Mon, 5 Feb 2024 21:22:40 +0100 Subject: [PATCH] feat: print version with `-v` or `--version` --- Cargo.toml | 2 +- src/main.rs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index ef6afde..dfc98c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "todoodoo" description = "todoodoo" -version = "0.2.0" +version = "0.2.1" edition = "2021" license = "GPL-3.0-only" diff --git a/src/main.rs b/src/main.rs index 3c0f290..6554388 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,6 +40,12 @@ impl Display for RunError { impl Error for 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"); let home_dir = homedir::get_my_home() .map_err(RunError::HomeDir)?