bare-script 0.1.1

The type-safe scripting authority for Rust. A framework for building robust shell commands and automation with 'Parse, don't validate' philosophy.
Documentation
//! Pipeline example - chain multiple commands.
//!
//! Run with: cargo run --example pipeline

use bare_script::sync::Pipeline;
use thiserror as _;
use tokio as _;

fn main() -> Result<(), bare_script::ScriptError> {
    // Echo "hello world" | grep "hello"
    #[cfg(windows)]
    let output = {
        Pipeline::new("cmd")
            .args(["/C", "echo hello world"])
            .pipe("findstr")
            .arg("hello")
            .capture_output()
            .execute()
    };

    #[cfg(not(windows))]
    let output = {
        Pipeline::new("echo")
            .arg("hello world")
            .pipe("grep")
            .arg("hello")
            .capture_output()
            .execute()
    };

    let output = output?;

    println!("Stdout: {}", output.stdout_str());
    println!("Success: {}", output.success());

    Ok(())
}