From 043b804c44665b07bd503fdad896bbe0a29311a0 Mon Sep 17 00:00:00 2001 From: Can Celik Date: Thu, 10 Sep 2026 23:33:27 +0300 Subject: feat: route cli commands to saved ssh machines (#3918) --- src/remote.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/remote.rs') diff --git a/src/remote.rs b/src/remote.rs index 768d90f1..c1c0f65f 100644 --- a/src/remote.rs +++ b/src/remote.rs @@ -10,6 +10,32 @@ pub(crate) use attach::*; pub(crate) use host::run_remote_client_bridge; pub(crate) use saved::*; +pub(crate) fn run_remote_api_bridge(args: &[String]) -> std::io::Result<()> { + match args { + [] => { + let path = crate::api::socket_path(); + let stream = crate::ipc::connect_local_stream(&path).map_err(|error| { + std::io::Error::new( + error.kind(), + format!( + "failed to connect to remote Herdr API socket {}: {error}", + path.display() + ), + ) + })?; + crate::platform::forward_remote_bridge_stdio(stream) + } + [flag] if flag == "--check" => { + println!("herdr-api-bridge-v1"); + Ok(()) + } + _ => Err(std::io::Error::new( + std::io::ErrorKind::InvalidInput, + "usage: herdr remote-api-bridge [--check]", + )), + } +} + pub(crate) fn print_saved_ssh_error_hint(err: &std::io::Error, target: &str) { if is_remote_host_key_error(err) { eprintln!( -- cgit v1.2.3