openssh icon indicating copy to clipboard operation
openssh copied to clipboard

arc_shell

Open kanpov opened this issue 1 year ago • 1 comments

The same as arc_command, but for shell.

I did this very easily via an extension trait, but it should be available out-of-the-box imo considering arc_command and arc_raw_command are there:

trait ArcShellExt {
    fn arc_shell<S: AsRef<str>>(self: Arc<Self>, command: S) -> OwningCommand<Arc<Self>>;
}

impl ArcShellExt for Session {
    fn arc_shell<S: AsRef<str>>(self: Arc<Self>, command: S) -> OwningCommand<Arc<Self>> {
        let mut cmd = self.arc_command("sh");
        cmd.arg("-c").arg(command.as_ref());
        cmd
    }
}

kanpov avatar Jul 13 '24 15:07 kanpov

That's neat!

I would welcome PR/contribution for that API!

NobodyXu avatar Jul 14 '24 01:07 NobodyXu