From e68641c0a773c4c79591545cfabb549c69ece45d Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 10 Feb 2024 08:40:13 +0400 Subject: Move CLI types to submodule --- src/utils.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index 9288df49..b215c3fd 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -11,6 +11,7 @@ use std::time::Duration; use anyhow::{ensure, Context}; use directories::UserDirs; +use git_version::git_version; use niri_config::Config; use smithay::output::Output; use smithay::reexports::rustix::time::{clock_gettime, ClockId}; @@ -20,6 +21,14 @@ pub fn clone2(t: (&T, &U)) -> (T, U) { (t.0.clone(), t.1.clone()) } +pub fn version() -> String { + format!( + "{} ({})", + env!("CARGO_PKG_VERSION"), + git_version!(fallback = "unknown commit"), + ) +} + pub fn get_monotonic_time() -> Duration { let ts = clock_gettime(ClockId::Monotonic); Duration::new(ts.tv_sec as u64, ts.tv_nsec as u32) -- cgit