rust-expect

Crates.iorust-expect
lib.rsrust-expect
version0.1.0
created_at2026-01-05 22:01:52.937683+00
updated_at2026-01-05 22:01:52.937683+00
descriptionNext-generation Expect-style terminal automation library for Rust
homepage
repositoryhttps://github.com/praxiomlabs/rust-expect
max_upload_size
id2024657
size1,327,713
Justin (jkindrix)

documentation

README

rust-expect

A modern, async-first terminal automation library for Rust, inspired by the classic Expect tool.

Features

  • Async/Await First: Built on Tokio for efficient, non-blocking I/O
  • Pattern Matching: Literal strings, regular expressions, and glob patterns
  • PTY Support: Full pseudo-terminal support on Unix and Windows
  • SSH Integration: Built-in SSH session management (optional)
  • Screen Emulation: Virtual terminal with ANSI escape sequence support
  • PII Redaction: Automatic sensitive data masking
  • Dialog Scripting: Declarative conversation flows
  • Human-like Typing: Configurable typing simulation

Usage

use rust_expect::prelude::*;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut session = Session::spawn("bash")?;

    session.expect("$ ").await?;
    session.send("echo 'Hello!'\n").await?;
    session.expect("Hello!").await?;
    session.send("exit\n").await?;

    Ok(())
}

Feature Flags

  • ssh - SSH session support
  • mock - Mock sessions for testing
  • screen - Virtual terminal emulation
  • pii-redaction - Automatic PII masking
  • test-utils - Testing utilities
  • metrics - Performance metrics
  • full - All features

License

Licensed under MIT or Apache-2.0.

Commit count: 89

cargo fmt