shell-candy 0.4.0

🍬 shell-candy wraps std::process::Command, providing a more straightforward mechanism for handling individual log lines.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use shell_candy::{ShellTask, ShellTaskBehavior, ShellTaskLog};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let task = ShellTask::new("rustc --version")?;
    // print $ rustc --version to the terminal
    eprintln!("{}", task.bash_descriptor());
    task.run(|line| match line {
        ShellTaskLog::Stderr(message) | ShellTaskLog::Stdout(message) => {
            eprintln!("{}", &message);
            ShellTaskBehavior::<()>::Passthrough
        }
    })?;
    Ok(())
}