summaryrefslogtreecommitdiff
path: root/src/remote.rs
diff options
context:
space:
mode:
authorCan Celik <ogulcancelik@gmail.com>2026-09-10 23:33:27 +0300
committerGitHub <noreply@github.com>2026-09-10 23:33:27 +0300
commit043b804c44665b07bd503fdad896bbe0a29311a0 (patch)
tree79bae0b64ba1c0e22328b0401196587633399c60 /src/remote.rs
parent425c86179791cd32e2d4ce0ae7f269940b4b0663 (diff)
feat: route cli commands to saved ssh machines (#3918)
Diffstat (limited to 'src/remote.rs')
-rw-r--r--src/remote.rs26
1 files changed, 26 insertions, 0 deletions
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!(