mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-28 01:34:16 +03:00
Include commit hash in Nightly & Dev builds (#10054)
Release Notes: - N/A <img width="1338" alt="image" src="https://github.com/zed-industries/zed/assets/16290753/c8442dbe-d293-46ef-abb1-ed8a6d9bf37d"> --------- Co-authored-by: Marshall Bowers <elliott.codes@gmail.com>
This commit is contained in:
parent
15ef3f3017
commit
c62239e9f0
@ -1,6 +1,6 @@
|
||||
use gpui::AppContext;
|
||||
use human_bytes::human_bytes;
|
||||
use release_channel::{AppVersion, ReleaseChannel};
|
||||
use release_channel::{AppCommitSha, AppVersion, ReleaseChannel};
|
||||
use serde::Serialize;
|
||||
use std::{env, fmt::Display};
|
||||
use sysinfo::{MemoryRefreshKind, RefreshKind, System};
|
||||
@ -13,12 +13,13 @@ pub struct SystemSpecs {
|
||||
os_version: Option<String>,
|
||||
memory: u64,
|
||||
architecture: &'static str,
|
||||
commit_sha: Option<String>,
|
||||
}
|
||||
|
||||
impl SystemSpecs {
|
||||
pub fn new(cx: &AppContext) -> Self {
|
||||
let app_version = AppVersion::global(cx).to_string();
|
||||
let release_channel = ReleaseChannel::global(cx).display_name();
|
||||
let release_channel = ReleaseChannel::global(cx);
|
||||
let os_name = cx.app_metadata().os_name;
|
||||
let system = System::new_with_specifics(
|
||||
RefreshKind::new().with_memory(MemoryRefreshKind::everything()),
|
||||
@ -29,14 +30,21 @@ impl SystemSpecs {
|
||||
.app_metadata()
|
||||
.os_version
|
||||
.map(|os_version| os_version.to_string());
|
||||
let commit_sha = match release_channel {
|
||||
ReleaseChannel::Dev | ReleaseChannel::Nightly => {
|
||||
AppCommitSha::try_global(cx).map(|sha| sha.0.clone())
|
||||
}
|
||||
_ => None,
|
||||
};
|
||||
|
||||
SystemSpecs {
|
||||
app_version,
|
||||
release_channel,
|
||||
release_channel: release_channel.display_name(),
|
||||
os_name,
|
||||
os_version,
|
||||
memory,
|
||||
architecture,
|
||||
commit_sha,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -47,8 +55,14 @@ impl Display for SystemSpecs {
|
||||
Some(os_version) => format!("OS: {} {}", self.os_name, os_version),
|
||||
None => format!("OS: {}", self.os_name),
|
||||
};
|
||||
let app_version_information =
|
||||
format!("Zed: v{} ({})", self.app_version, self.release_channel);
|
||||
let app_version_information = format!(
|
||||
"Zed: v{} ({})",
|
||||
self.app_version,
|
||||
match &self.commit_sha {
|
||||
Some(commit_sha) => format!("{} {}", self.release_channel, commit_sha),
|
||||
None => self.release_channel.to_string(),
|
||||
}
|
||||
);
|
||||
let system_specs = [
|
||||
app_version_information,
|
||||
os_information,
|
||||
|
Loading…
Reference in New Issue
Block a user