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
//! Basic command execution example.
//!
//! Run with: cargo run --example basic

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

fn main() -> Result<(), bare_script::ScriptError> {
    // Simple echo command
    #[cfg(windows)]
    let output = {
        CommandBuilder::new("cmd")
            .args(["/C", "echo Hello from bare-script!"])
            .capture_output()
            .execute()
    };

    #[cfg(not(windows))]
    let output = {
        CommandBuilder::new("echo")
            .arg("Hello from bare-script!")
            .capture_output()
            .execute()
    };

    let output = output?;

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

    Ok(())
}