Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
cli: Refactor URL prefix checks (#38375)
Xiaobo Liufbe06238e45c
diff --git a/crates/cli/src/main.rs b/crates/cli/src/main.rsindex d0d30f72d7a..b1a7ebbd8c4 100644--- a/crates/cli/src/main.rs+++ b/crates/cli/src/main.rs@@ -20,6 +20,8 @@ use util::paths::PathWithPosition;#[cfg(any(target_os = "linux", target_os = "freebsd"))]use std::io::IsTerminal;+const URL_PREFIX: [&'static str; 5] = ["zed://", "http://", "https://", "file://", "ssh://"];+struct Detect;trait InstalledApp {@@ -310,12 +312,7 @@ fn main() -> Result<()> {let wsl = None;for path in args.paths_with_position.iter() {- if path.starts_with("zed://")- || path.starts_with("http://")- || path.starts_with("https://")- || path.starts_with("file://")- || path.starts_with("ssh://")- {+ if URL_PREFIX.iter().any(|&prefix| path.starts_with(prefix)) {urls.push(path.to_string());} else if path == "-" && args.paths_with_position.len() == 1 {let file = NamedTempFile::new()?;