shutil 0.1.2

Shell utility helper library
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 43.57 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.14 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 9s Average build duration of successful builds.
  • all releases: 9s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • rajbot/shutil
    0 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • rajbot

shutil

Rust shell utility helper library

Installing

cargo add shutil

Using command pipelines in rust

shutil::pipe() makes it easy to execute command pipelines in rust.

For example, say you want to execute the following pipeline:

echo foo | rev | tr 'a-z' 'A-Z'

This will echo the string "foo", reverse it, and then change lowercase characters to uppercase. The result will be the string "OOF". Here is the equivalent rust code:

use shutil::pipe;

fn main() {
    // Executes `echo "foo" | rev | tr "a-z" "A-Z"`
    let output = pipe(vec![
        vec!["echo", "foo"],
        vec!["rev"],
        vec!["tr", "a-z", "A-Z"],
    ]);

    // prints "OOF"
    println!("{}", output.unwrap());
}