Files
zed/crates/remote_server/src/main.rs
T
Lukas Wirth 45bebd2ccf remote: Fix naming inconsistencies (#46146)
Renames a bunch of ssh things to remote when its actually about remotes
in general

Release Notes:

- N/A *or* Added/Fixed/Improved ...
2026-01-06 10:07:10 +00:00

58 lines
1.5 KiB
Rust

use clap::Parser;
use remote_server::Commands;
use std::path::PathBuf;
#[derive(Parser)]
#[command(disable_version_flag = true)]
struct Cli {
#[command(subcommand)]
command: Option<Commands>,
/// Used for SSH/Git password authentication, to remove the need for netcat as a dependency,
/// by having Zed act like netcat communicating over a Unix socket.
#[arg(long, hide = true)]
askpass: Option<String>,
/// Used for recording minidumps on crashes by having the server run a separate
/// process communicating over a socket.
#[arg(long, hide = true)]
crash_handler: Option<PathBuf>,
/// Used for loading the environment from the project.
#[arg(long, hide = true)]
printenv: bool,
}
fn main() -> anyhow::Result<()> {
let cli = Cli::parse();
if let Some(socket_path) = &cli.askpass {
askpass::main(socket_path);
return Ok(());
}
if let Some(socket) = &cli.crash_handler {
crashes::crash_server(socket.as_path());
return Ok(());
}
if cli.printenv {
util::shell_env::print_env();
return Ok(());
}
#[cfg(not(windows))]
if let Some(command) = cli.command {
remote_server::run(command)
} else {
eprintln!("usage: remote <run|proxy|version>");
std::process::exit(1);
}
#[cfg(windows)]
if let Some(_) = cli.command {
eprintln!("run is not supported on Windows");
std::process::exit(2);
} else {
eprintln!("usage: remote <run|proxy|version>");
std::process::exit(1);
}
}