tastty-driver 0.1.0

Terminal automation driver built on tastty
//! Active terminal-control layer built on top of [`tastty`].
//!
//! `tastty-driver` owns the higher-level verbs used by test runners,
//! snapshotters, and programs that drive long-running interactive children:
//! spawn, send, wait, snapshot, inspect, signal, terminate, and kill.
//!
//! # Basic usage
//!
//! ```no_run
//! use std::time::Duration;
//! use tastty_driver::{Builder, InputSegment, Session, WaitCondition};
//!
//! let session = Session::spawn(Builder::command("bash"))?;
//! session.send_input(&[InputSegment::Text("echo hello\n".into())])?;
//! let outcome = session.wait(
//!     WaitCondition::regex("hello"),
//!     Duration::from_secs(5),
//! )?;
//! println!("{}", outcome.snapshot.text());
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
//!
//! With the `async` feature enabled, [`Session::wait_async`] returns a
//! runtime-agnostic future suitable for `tokio::select!` arms.
//!
//! For VT parser, screen-buffer, host-reply, and input-encoding details,
//! see the [`tastty`] crate documentation, which in turn re-exports the
//! sans-I/O building blocks from `tastty-core`.

#![cfg_attr(docsrs, feature(doc_auto_cfg))]
#![warn(
    missing_docs,
    rustdoc::broken_intra_doc_links,
    rustdoc::private_intra_doc_links,
    unreachable_pub
)]

mod color;
mod error;
mod exit_status;
mod input;
mod observer;
mod search;
mod session;
mod signal;
mod snapshot;
mod styles;
mod wait;

pub use color::{ParseColorError, parse_color};
pub use error::{Error, InvalidRegexSource, Result};
pub use exit_status::ExitStatus;
pub use input::{InputSegment, ParseInputError, parse_input};
pub use observer::IoObserver;
pub use search::{
    Capture, DEFAULT_NFA_SIZE_LIMIT, RegexPattern, SearchDirection, SearchError, SearchMatch,
    SearchOptions, SearchPattern,
};
pub use session::{DriverOptions, Session};
pub use signal::Signal;
pub use snapshot::{CellSnapshot, InspectSnapshot, ScrollbackSnapshot, Snapshot, StyleRun};
pub use styles::{
    ColorFilter, RowRange, StyleFilter, StyleInventory, StyleInventoryEntry, StyleMatchRow,
    StyleMatchSpan, StyleMatches,
};
pub use wait::{
    DEFAULT_POLL_INTERVAL, RegexCondition, StableCondition, WaitCondition, WaitError, WaitMatch,
    WaitOutcome,
};

pub use tastty::input::{KeyCode, KeyEvent, KeyModifiers};
pub use tastty::{
    AbsolutePosition, Attrs, Builder, Color, CursorShape, CursorStyle, Hyperlink, IoError,
    IoErrorReceiver, Position, ReaderError, TerminalMode, TerminalSize, UnderlineStyle,
    WriterError, WriterOperation,
};