openssh
openssh copied to clipboard
Add `.with_args` feature to rust library
This features exists in bossy::Command here: https://docs.rs/bossy/latest/bossy/struct.Command.html#method.with_args
It is quite useful, allowing you to write this:
let kill_cmd = session.command("/root/.cargo/bin/nu").withargs([
"-c",
r##"ps | filter {|ps| $ps.name == "surreal"} | get pid | each {|pid| kill $pid }"##,
]);
... instead of this:
let mut kill_cmd = session.command("/root/.cargo/bin/nu");
kill_cmd.args([
"-c",
r##"ps | filter {|ps| $ps.name == "surreal"} | get pid | each {|pid| kill $pid }"##,
]);
This saves using the mut
keyword and a new line, and can even be implemented trivially using an extension trait