Build coverage status crate docs.rs

expectrl

A tool for automating terminal applications on Unix and on Windows.

Using the library you can:

expectrl like original expect may shine when you're working with interactive applications. If your application is not interactive you may not find the library the best choise.

Usage

A general example where the program simulates a used interacting with ftp.

```rust use expectrl::{spawn, Regex, Eof, WaitStatus};

fn main() { let mut p = spawn("ftp speedtest.tele2.net").unwrap(); p.expect(Regex("Name \(.*\):")).unwrap(); p.sendline("anonymous").unwrap(); p.expect("Password").unwrap(); p.sendline("test").unwrap(); p.expect("ftp>").unwrap(); p.sendline("cd upload").unwrap(); p.expect("successfully changed.\r\nftp>").unwrap(); p.sendline("pwd").unwrap(); p.expect(Regex("[0-9]+ \"/upload\"")).unwrap(); p.sendline("exit").unwrap(); p.expect(Eof).unwrap(); asserteq!(p.wait().unwrap(), WaitStatus::Exited(p.pid(), 0)); } ```

The example inspired by the one in [philippkeller/rexpect].

For more examples, check the examples directory.

Features

Notes

It was originally inspired by [philippkeller/rexpect] and [pexpect].

Licensed under MIT License