rrun-ssh 0.3.0

Remote run utility; runs a command via SSH if the current directory was mounted via SSHFS.
Documentation
use std::ffi::OsString;
use std::process::Command;


/// Builder for the command-line arguments for a program.
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ProgramArgs {
    program: OsString,
    args: Vec<OsString>,
}
impl ProgramArgs {
    /// Creates a builder for `ProgramArgs` from a program name.
    #[inline]
    pub fn new<S: Into<OsString>>(program: S) -> ProgramArgs {
        ProgramArgs {
            program: program.into(),
            args: Vec::new(),
        }
    }

    /// Appends a single argument.
    #[inline]
    pub fn push<S: Into<OsString>>(&mut self, arg: S) {
        self.args.push(arg.into());
    }

    /// Converts these arguments into a command to run.
    pub fn into_command(self) -> Command {
        let mut cmd = Command::new(&self.program);
        cmd.args(&self.args);
        cmd
    }
}
impl<S: Into<OsString>> Extend<S> for ProgramArgs {
    fn extend<T: IntoIterator<Item = S>>(&mut self, iterable: T) {
        self.args.extend(iterable.into_iter().map(Into::into));
    }
}