Code to allow opening zed:/channel/1234

Refactored a bit how url arguments are handled to avoid adding too much
extra complexity to main.
This commit is contained in:
Conrad Irwin 2023-10-05 14:23:14 -06:00 committed by Mikayla
parent b258ee5f77
commit 13192fa03c
No known key found for this signature in database
6 changed files with 272 additions and 149 deletions

View file

@ -17,15 +17,14 @@ lazy_static! {
_ => panic!("invalid release channel {}", *RELEASE_CHANNEL_NAME),
};
static ref URL_SCHEME: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {
pub static ref URL_SCHEME_PREFIX: String = match RELEASE_CHANNEL_NAME.as_str() {
"dev" => "zed-dev:/",
"preview" => "zed-preview:/",
"stable" => "zed:/",
// NOTE: this must be kept in sync with ./script/bundle and https://zed.dev.
// NOTE: this must be kept in sync with osx_url_schemes in Cargo.toml and with https://zed.dev.
_ => unreachable!(),
})
.unwrap();
static ref LINK_PREFIX: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {
}.to_string();
pub static ref LINK_PREFIX: Url = Url::parse(match RELEASE_CHANNEL_NAME.as_str() {
"dev" => "http://localhost:3000/dev/",
"preview" => "https://zed.dev/preview/",
"stable" => "https://zed.dev/",
@ -59,12 +58,4 @@ impl ReleaseChannel {
ReleaseChannel::Stable => "stable",
}
}
pub fn url_scheme(&self) -> &'static Url {
&URL_SCHEME
}
pub fn link_prefix(&self) -> &'static Url {
&LINK_PREFIX
}
}