shelle
Macros for writing shell scripts in Rust.
This project is based on cmd_lib. Thanks to @tao-guo and other contributors for your hard work.
Usage
shelle::exec!() runs command(s) with stdin/stdout/stderr inherited from the main program:
let msg = "I love rust";
exec!?;
exec!?;
// pipe commands are also supported
let dir = "/var/log";
exec!?;
// or a group of commands
// if any command fails, just return Err(...)
let file = "/tmp/f";
let keyword = "rust";
exec! ?;
shelle::eval!() runs command(s) with stdout piped to a string, and stdin/stderr inherited from the main program:
let version = eval!?;
println!;
// with pipes
let n = eval!?;
println!;