Expand description

This library provides ShellTask, a type that wraps std::process::Command to allow for functional control over lines printed to stderr and stdout by POSIX style tools.

Examples

use shell_candy::{ShellTask, ShellTaskLog, ShellTaskBehavior};

fn main() -> Result<(), Box<dyn std::error::Error>> {
  let task = ShellTask::new("rustc --version")?;

  let _: Option<()> = task.run(|line| {
   match line {
      ShellTaskLog::Stderr(message) | ShellTaskLog::Stdout(message) => {
        eprintln!("{}", &message);
        ShellTaskBehavior::Passthrough
      },
   }
  })?;
  Ok(())
}

Structs

A ShellTask runs commands and provides a passthrough log handler for each log line.

Enums

The possible errors reported by a ShellTask.
ShellTaskBehavior allows you to terminate a process early, or to continue inside your log handler.
A log message emitted by a ShellTask.

Type Definitions

The result type used by a ShellTask.