3 releases (1 stable)
1.0.0 | Oct 14, 2020 |
---|---|
0.1.0 | Oct 14, 2020 |
0.0.0 | Oct 14, 2020 |
#20 in #subprocess
304 downloads per month
Used in 4 crates
5KB
56 lines
Command Extra
Additional methods for std::process::Command
.
Motivation
Default Command
mutation methods take a mutable reference and return a mutable reference, making sharing code verbose:
fn shared_command() -> Command {
let mut command = Command::new("command");
command
.current_dir("work-dir")
.env("FOO", "foo")
.arg("bar");
command
}
With CommandExtra
, the above code can be shorter:
fn shared_command() -> Command {
Command::new("command")
.with_current_dir("work-dir")
.with_env("FOO", "foo")
.with_arg("bar")
}