diff options
author | Wilfred Hughes <me@wilfred.me.uk> | 2024-08-29 22:52:36 -0700 |
---|---|---|
committer | Wilfred Hughes <me@wilfred.me.uk> | 2024-08-29 22:52:36 -0700 |
commit | 3c62ff37c04b1f8a6c625a0c8ac11a04d284d939 (patch) | |
tree | 7887f3db51102ec7375895ecff7b79c070e86f93 | |
parent | 65dab7ef15608fa4ecdbf6e58b6ec6b16034c73f (diff) |
Include OS in --version
Fixes #757
-rw-r--r-- | src/version.rs | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/version.rs b/src/version.rs index b075a8f873..e96adf5280 100644 --- a/src/version.rs +++ b/src/version.rs @@ -15,24 +15,25 @@ pub(crate) struct VersionInfo { impl fmt::Display for VersionInfo { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.version)?; + write!(f, "{}\n\n", self.version)?; - match (&self.commit_info, self.rustc_version) { - (Some(commit_info), Some(rustc_version)) => write!( + if let Some(commit_info) = &self.commit_info { + writeln!( f, - " ({} {}, built with rustc {})", - commit_info.short_commit_hash, commit_info.commit_date, rustc_version - )?, - (Some(commit_info), None) => write!( - f, - " ({} {})", + "Revision: {} {}", commit_info.short_commit_hash, commit_info.commit_date - )?, - (None, Some(rustc_version)) => write!(f, " (built with rustc {})", rustc_version)?, - (None, None) => {} + )?; + } + if let Some(rustc_version) = self.rustc_version { + writeln!(f, "Toolchain: {}", rustc_version)?; } - Ok(()) + writeln!( + f, + "System: {} {}", + std::env::consts::OS, + std::env::consts::ARCH + ) } } |