command-stream 0.9.6

Modern shell command execution library with streaming, async iteration, and event support
Documentation

command-stream for Rust

crates.io Rust CI License

Rust implementation of command-stream: a shell command execution library with streaming, events, shell parsing, virtual commands, and built-in command support.

Installation

cargo add command-stream

Library Usage

use command_stream::CommandResult;
use command_stream::commands::echo::EchoCommand;
use command_stream::commands::VirtualCommand;

#[tokio::main]
async fn main() {
    let command = EchoCommand;
    let result: CommandResult = command
        .execute(&["hello".to_string(), "from".to_string(), "rust".to_string()], None)
        .await
        .expect("echo should run");

    assert_eq!(result.stdout.trim(), "hello from rust");
}

Command Line

The crate also builds a command-stream binary:

cargo run -- echo hello

Features

  • Shell parser for pipelines, command lists, logical operators, and redirection.
  • Built-in command implementations for file-system and shell utility commands.
  • Async execution with tokio.
  • Virtual command abstractions for embedding command behavior in Rust programs.
  • Cross-platform tests covering parser, state, events, streams, and built-ins.

Development

cargo fmt --all -- --check
cargo clippy --all-targets --all-features
cargo test --all-features
cargo test --doc --all-features
cargo package --allow-dirty

Rust release automation lives in scripts/ and is controlled by .github/workflows/rust.yml from the repository root.