Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ksxgithub/command-extra
Additional methods for std::process::Command
https://github.com/ksxgithub/command-extra
command library process rust subprocess trait utility
Last synced: 13 days ago
JSON representation
Additional methods for std::process::Command
- Host: GitHub
- URL: https://github.com/ksxgithub/command-extra
- Owner: KSXGitHub
- License: mit
- Created: 2020-10-14T07:46:15.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T23:56:41.000Z (over 1 year ago)
- Last Synced: 2024-04-24T05:19:22.840Z (7 months ago)
- Topics: command, library, process, rust, subprocess, trait, utility
- Language: Rust
- Homepage: https://lib.rs/crates/command-extra
- Size: 22.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Command Extra
[![Test](https://github.com/KSXGitHub/command-extra/workflows/Test/badge.svg)](https://github.com/KSXGitHub/command-extra/actions?query=workflow%3ATest)
[![Travis Build Status](https://img.shields.io/travis/KSXGitHub/command-extra/master?label=build&logo=travis)](https://travis-ci.org/KSXGitHub/command-extra)
[![Crates.io Version](https://img.shields.io/crates/v/command-extra?logo=rust)](https://crates.io/crates/command-extra)
[![Documentation](https://docs.rs/command-extra/badge.svg)](https://docs.rs/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:
```rust
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:
```rust
fn shared_command() -> Command {
Command::new("command")
.with_current_dir("work-dir")
.with_env("FOO", "foo")
.with_arg("bar")
}
```## License
[MIT](https://git.io/JTmyt) © [Hoàng Văn Khải](https://KSXGitHub.github.io/)