(
server: &str,
gateway: &str,
name: &str,
editor: Editor,
tls: &TlsOptions,
)
| 291 | } |
| 292 | |
| 293 | pub async fn sandbox_connect_editor( |
| 294 | server: &str, |
| 295 | gateway: &str, |
| 296 | name: &str, |
| 297 | editor: Editor, |
| 298 | tls: &TlsOptions, |
| 299 | ) -> Result<()> { |
| 300 | // Verify the sandbox exists before writing SSH config / launching the editor. |
| 301 | let mut client = grpc_client(server, tls).await?; |
| 302 | client |
| 303 | .get_sandbox(GetSandboxRequest { |
| 304 | name: name.to_string(), |
| 305 | }) |
| 306 | .await |
| 307 | .into_diagnostic()? |
| 308 | .into_inner() |
| 309 | .sandbox |
| 310 | .ok_or_else(|| miette::miette!("sandbox not found: {name}"))?; |
| 311 | |
| 312 | let host_alias = host_alias(name); |
| 313 | install_ssh_config(gateway, name)?; |
| 314 | launch_editor(editor, &host_alias)?; |
| 315 | eprintln!( |
| 316 | "{} Opened {} for sandbox {}", |
| 317 | "✓".green().bold(), |
| 318 | editor.label(), |
| 319 | name |
| 320 | ); |
| 321 | Ok(()) |
| 322 | } |
| 323 | |
| 324 | /// Forward a local port to a sandbox via SSH. |
| 325 | /// |
no test coverage detected