Skip to content

Commit e2cdb92

Browse files
committed
Format README
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
1 parent d89b7ef commit e2cdb92

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,28 @@
44
[![Released API docs](https://docs.rs/rexpect/badge.svg)](https://docs.rs/rexpect)
55
[![Master API docs](https://img.shields.io/badge/docs-master-2f343b.svg)](http://philippkeller.github.io/rexpect)
66

7-
8-
Spawn, control, and respond to expected patterns of child applications and processes, enabling the automation of interactions and testing. Components include:
9-
- **session**: start a new process and interact with it; primary module of rexpect.
10-
- **reader**: non-blocking reader, which supports waiting for strings, regex, and EOF.
7+
Spawn, control, and respond to expected patterns of child applications and
8+
processes, enabling the automation of interactions and testing. Components
9+
include:
10+
11+
- **session**: start a new process and interact with it; primary module of
12+
rexpect.
13+
- **reader**: non-blocking reader, which supports waiting for strings, regex,
14+
and EOF.
1115
- **process**: spawn a process in a pty.
1216

13-
The goal is to offer a similar set of functionality as [pexpect](https://pexpect.readthedocs.io/en/stable/overview.html).
17+
The goal is to offer a similar set of functionality as
18+
[pexpect](https://pexpect.readthedocs.io/en/stable/overview.html).
1419

1520
## Maintainers wanted
1621

17-
I have created rexpect as a project to learn rust and linux. But now due to some reasons I haven't used Rust in the past 2 years, so I can't keep up with the latest features/crate dependencies
22+
I have created rexpect as a project to learn rust and linux. But now due to some
23+
reasons I haven't used Rust in the past 2 years, so I can't keep up with the
24+
latest features/crate dependencies
1825

19-
It has become hard now to judge pull requests. If you would be willing to either take over this repo entirely or join in as a maintainer to help evaluate PR please contact me.
26+
It has become hard now to judge pull requests. If you would be willing to either
27+
take over this repo entirely or join in as a maintainer to help evaluate PR
28+
please contact me.
2029

2130
## Examples
2231

@@ -55,24 +64,21 @@ fn do_ftp() -> Result<()> {
5564
Ok(())
5665
}
5766

58-
5967
fn main() {
6068
do_ftp().unwrap_or_else(|e| panic!("ftp job failed with {}", e));
6169
}
6270
```
6371

6472
### Example with bash and reading from programs
6573

66-
6774
```rust
6875
extern crate rexpect;
6976
use rexpect::spawn_bash;
7077
use rexpect::errors::*;
7178

72-
7379
fn do_bash() -> Result<()> {
7480
let mut p = spawn_bash(Some(2000))?;
75-
81+
7682
// case 1: wait until program is done
7783
p.send_line("hostname")?;
7884
let hostname = p.read_line()?;
@@ -102,7 +108,6 @@ fn do_bash() -> Result<()> {
102108
fn main() {
103109
do_bash().unwrap_or_else(|e| panic!("bash job failed with {}", e));
104110
}
105-
106111
```
107112

108113
### Example with bash and job control
@@ -122,7 +127,6 @@ extern crate rexpect;
122127
use rexpect::spawn_bash;
123128
use rexpect::errors::*;
124129

125-
126130
fn do_bash_jobcontrol() -> Result<()> {
127131
let mut p = spawn_bash(Some(1000))?;
128132
p.execute("ping 8.8.8.8", "bytes of data")?;
@@ -157,7 +161,9 @@ rust stable, beta and nightly on both Linux or Mac.
157161
## Design decisions
158162

159163
- use error handling of [error-chain](https://github.com/brson/error-chain)
160-
- use [nix](https://github.com/nix-rust/nix) (and avoid libc wherever possible) to keep the code safe and clean
161-
- sadly, `expect` is used in rust too prominently to unwrap `Option`s and `Result`s, use `exp_*` instead
164+
- use [nix](https://github.com/nix-rust/nix) (and avoid libc wherever possible)
165+
to keep the code safe and clean
166+
- sadly, `expect` is used in rust too prominently to unwrap `Option`s and
167+
`Result`s, use `exp_*` instead
162168

163169
Licensed under [MIT License](LICENSE)

0 commit comments

Comments
 (0)