<commit_before># pty-shell

## Usage

Add this to your `Cargo.toml`:

```toml
[dependencies]

pty = '0.1.6'
pty-shell = '0.1.0'
```

For example, add src/main.rs as following:

```rust
extern crate pty;
extern crate pty_shell;

use pty_shell::{PtyProxy, PtyHandler};
use std::process::{Command, Stdio};

struct Shell;
impl PtyHandler for Shell {
    fn input(&mut self, _data: Vec<u8>) {
        aplay("sound-effect-for-input.wav");
    }

    fn output(&mut self, _data: Vec<u8>) {
        aplay("sound-effect-for-output.wav");
    }
}

fn aplay<F: AsRef<str>>(file: F) {
    Command::new("aplay").arg(file.as_ref()).stderr(Stdio::null()).spawn();
}

fn main() {
    let child = pty::fork().unwrap();

    child.exec("bash");
    child.proxy(Shell);
    child.wait();
}
```

## Contributing

1. Fork it ( https://github.com/hibariya/pty-shell/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## License

Copyright (c) 2015 <NAME>

Distributed under the [MIT License](LICENSE.txt).<commit_msg>Add callback-style usage<commit_after># pty-shell

## Usage

Add this to your `Cargo.toml`:

```toml
[dependencies]

pty = '0.1.6'
pty-shell = '0.1.0'
```

For example, add src/main.rs as following:

```rust
extern crate pty;
extern crate pty_shell;

use pty_shell::{PtyProxy, PtyHandler};
use std::process::{Command, Stdio};

struct Shell;
impl PtyHandler for Shell {
    fn input(&mut self, _data: Vec<u8>) {
        aplay("sound-effect-for-input.wav");
    }

    fn output(&mut self, _data: Vec<u8>) {
        aplay("sound-effect-for-output.wav");
    }
}

fn aplay<F: AsRef<str>>(file: F) {
    Command::new("aplay").arg(file.as_ref()).stderr(Stdio::null()).spawn();
}

fn main() {
    let child = pty::fork().unwrap();

    child.exec("bash");
    child.proxy(Shell);
    child.wait();
}
```

### Callback Style

Use `pty_shell::PtyCallback`.

```rust
child.proxy(PtyCallback::new(
    |_| aplay("sound1.wav"),
    |_| aplay("sound2.wav"),
));
```

## Contributing

1. Fork it ( https://github.com/hibariya/pty-shell/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## License

Copyright (c) 2015 <NAME>

Distributed under the [MIT License](LICENSE.txt).
{'fraction_non_alphanumeric': 0.17915831663326653, 'fraction_numerical': 0.014428857715430862, 'mean_word_length': 3.763358778625954, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3764106', 'n_tokens_mistral': 958, 'n_tokens_neox': 922, 'n_words': 235}