History

Remove wsl command line args on non-windows platforms (#37422)

Release Notes: - N/A

Max Brunsfeld committed 1 year ago

Commit f2309601 parent 1ed17fd2 files · +20 −3Browse files

Unified · Split

2 files
  1. crates/cli/src/main.rs +13 −2
  2. crates/zed/src/main.rs +7 −1
crates/cli/src/main.rs+13−2
@@ -93,6 +93,7 @@ struct Args { · 92 unmodified lines
93 /// Example: `me@Ubuntu` or `Ubuntu`.93 /// Example: `me@Ubuntu` or `Ubuntu`.
94 ///94 ///
95 /// WARN: You should not fill in this field by hand.95 /// WARN: You should not fill in this field by hand.
96 #[cfg(target_os = "windows")]
96 #[arg(long, value_name = "USER@DISTRO")]97 #[arg(long, value_name = "USER@DISTRO")]
97 wsl: Option<String>,98 wsl: Option<String>,
98 /// Not supported in Zed CLI, only supported on Zed binary99 /// Not supported in Zed CLI, only supported on Zed binary
@@ -303,6 +304,11 @@ fn main() -> Result<()> { · 204 unmodified lines
303 ]);304 ]);
304 }305 }
305 306
307 #[cfg(target_os = "windows")]
308 let wsl = args.wsl.as_ref();
309 #[cfg(not(target_os = "windows"))]
310 let wsl = None;
311
306 for path in args.paths_with_position.iter() {312 for path in args.paths_with_position.iter() {
307 if path.starts_with("zed://")313 if path.starts_with("zed://")
308 || path.starts_with("http://")314 || path.starts_with("http://")
@@ -321,7 +327,7 @@ fn main() -> Result<()> { · 12 unmodified lines
321 paths.push(tmp_file.path().to_string_lossy().to_string());327 paths.push(tmp_file.path().to_string_lossy().to_string());
322 let (tmp_file, _) = tmp_file.keep()?;328 let (tmp_file, _) = tmp_file.keep()?;
323 anonymous_fd_tmp_files.push((file, tmp_file));329 anonymous_fd_tmp_files.push((file, tmp_file));
324 } else if let Some(wsl) = &args.wsl {330 } else if let Some(wsl) = wsl {
325 urls.push(format!("file://{}", parse_path_in_wsl(path, wsl)?));331 urls.push(format!("file://{}", parse_path_in_wsl(path, wsl)?));
326 } else {332 } else {
327 paths.push(parse_path_with_position(path)?);333 paths.push(parse_path_with_position(path)?);
@@ -340,11 +346,16 @@ fn main() -> Result<()> { · 12 unmodified lines
340 let (_, handshake) = server.accept().context("Handshake after Zed spawn")?;346 let (_, handshake) = server.accept().context("Handshake after Zed spawn")?;
341 let (tx, rx) = (handshake.requests, handshake.responses);347 let (tx, rx) = (handshake.requests, handshake.responses);
342 348
349 #[cfg(target_os = "windows")]
350 let wsl = args.wsl;
351 #[cfg(not(target_os = "windows"))]
352 let wsl = None;
353
343 tx.send(CliRequest::Open {354 tx.send(CliRequest::Open {
344 paths,355 paths,
345 urls,356 urls,
346 diff_paths,357 diff_paths,
347 wsl: args.wsl,358 wsl,
348 wait: args.wait,359 wait: args.wait,
349 open_new_workspace,360 open_new_workspace,
350 env,361 env,
crates/zed/src/main.rs+7−1
@@ -707,11 +707,16 @@ pub fn main() { · 706 unmodified lines
707 .map(|chunk| [chunk[0].clone(), chunk[1].clone()])707 .map(|chunk| [chunk[0].clone(), chunk[1].clone()])
708 .collect();708 .collect();
709 709
710 #[cfg(target_os = "windows")]
711 let wsl = args.wsl;
712 #[cfg(not(target_os = "windows"))]
713 let wsl = None;
714
710 if !urls.is_empty() || !diff_paths.is_empty() {715 if !urls.is_empty() || !diff_paths.is_empty() {
711 open_listener.open(RawOpenRequest {716 open_listener.open(RawOpenRequest {
712 urls,717 urls,
713 diff_paths,718 diff_paths,
714 wsl: args.wsl,719 wsl,
715 })720 })
716 }721 }
717 722
@@ -1192,6 +1197,7 @@ struct Args { · 474 unmodified lines
1192 /// Example: `me@Ubuntu` or `Ubuntu`.1197 /// Example: `me@Ubuntu` or `Ubuntu`.
1193 ///1198 ///
1194 /// WARN: You should not fill in this field by hand.1199 /// WARN: You should not fill in this field by hand.
1200 #[cfg(target_os = "windows")]
1195 #[arg(long, value_name = "USER@DISTRO")]1201 #[arg(long, value_name = "USER@DISTRO")]
1196 wsl: Option<String>,1202 wsl: Option<String>,
1197 1203