diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-10 08:40:13 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-10 08:40:13 +0400 |
| commit | e68641c0a773c4c79591545cfabb549c69ece45d (patch) | |
| tree | 518e519584834b0ea8e1b429b9b1c2a2d0d1f93a /src/utils.rs | |
| parent | 2a892ef5116999d17c7e87e4f915219d45bf1219 (diff) | |
| download | niri-e68641c0a773c4c79591545cfabb549c69ece45d.tar.gz niri-e68641c0a773c4c79591545cfabb549c69ece45d.tar.bz2 niri-e68641c0a773c4c79591545cfabb549c69ece45d.zip | |
Move CLI types to submodule
Diffstat (limited to 'src/utils.rs')
| -rw-r--r-- | src/utils.rs | 9 |
1 files changed, 9 insertions, 0 deletions
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: Clone, U: Clone>(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) |
