mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 11:01:54 +00:00
40 lines
1.1 KiB
Rust
40 lines
1.1 KiB
Rust
use std::env;
|
|
|
|
use lazy_static::lazy_static;
|
|
|
|
lazy_static! {
|
|
pub static ref RELEASE_CHANNEL_NAME: String = env::var("ZED_RELEASE_CHANNEL")
|
|
.unwrap_or_else(|_| include_str!("../../zed/RELEASE_CHANNEL").to_string());
|
|
pub static ref RELEASE_CHANNEL: ReleaseChannel = match RELEASE_CHANNEL_NAME.as_str() {
|
|
"dev" => ReleaseChannel::Dev,
|
|
"preview" => ReleaseChannel::Preview,
|
|
"stable" => ReleaseChannel::Stable,
|
|
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
|
|
};
|
|
}
|
|
|
|
#[derive(Copy, Clone, PartialEq, Eq, Default)]
|
|
pub enum ReleaseChannel {
|
|
#[default]
|
|
Dev,
|
|
Preview,
|
|
Stable,
|
|
}
|
|
|
|
impl ReleaseChannel {
|
|
pub fn display_name(&self) -> &'static str {
|
|
match self {
|
|
ReleaseChannel::Dev => "Zed Dev",
|
|
ReleaseChannel::Preview => "Zed Preview",
|
|
ReleaseChannel::Stable => "Zed",
|
|
}
|
|
}
|
|
|
|
pub fn dev_name(&self) -> &'static str {
|
|
match self {
|
|
ReleaseChannel::Dev => "dev",
|
|
ReleaseChannel::Preview => "preview",
|
|
ReleaseChannel::Stable => "stable",
|
|
}
|
|
}
|
|
}
|