command-extra

Crates.iocommand-extra
lib.rscommand-extra
version1.0.0
sourcesrc
created_at2020-10-14 08:20:57.136452
updated_at2020-10-14 08:22:39.192285
descriptionAdditional methods for std::process::Command
homepage
repositoryhttps://github.com/KSXGitHub/command-extra.git
max_upload_size
id299567
size5,454
Khải (KSXGitHub)

documentation

https://docs.rs/command-extra

README

Command Extra

Test Travis Build Status Crates.io Version Documentation

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")
}

License

MIT © Hoàng Văn Khải

Commit count: 33

cargo fmt