#terminal #process #tty

terminal-trx

Provides a handle to the terminal of the current process

6 releases

0.2.4 Jan 24, 2025
0.2.3 Aug 22, 2024
0.2.2 Jul 31, 2024
0.2.1 Jun 7, 2024
0.1.0 Jan 20, 2024

#200 in Command-line interface

Download history 7235/week @ 2025-01-21 7941/week @ 2025-01-28 8799/week @ 2025-02-04 9308/week @ 2025-02-11 9089/week @ 2025-02-18 9982/week @ 2025-02-25 11518/week @ 2025-03-04 15464/week @ 2025-03-11 19420/week @ 2025-03-18 15768/week @ 2025-03-25 17823/week @ 2025-04-01 18455/week @ 2025-04-08 15504/week @ 2025-04-15 16554/week @ 2025-04-22 18605/week @ 2025-04-29 19544/week @ 2025-05-06

73,207 downloads per month
Used in 18 crates (via terminal-colorsaurus)

MIT/Apache

44KB
910 lines

terminal-trx

Docs Crate Version

Pronounced: Terminal T-Rex 🦖

Provides a handle to the terminal of the current process that is both readable and writable.

Example

use terminal_trx::terminal;
use std::io::{BufReader, BufRead as _, Write as _};

let mut terminal = terminal().unwrap();

write!(terminal, "hello world").unwrap();

let mut reader = BufReader::new(&mut terminal);
let mut line = String::new();
reader.read_line(&mut line).unwrap();

Docs

Wishlist

These are some features that I would like to include in this crate, but have not yet had the time to implement. Anyone is welcome to create a PR :)

  • Add integration tests.
  • Share the Terminal instance (like stdout, stderr, stdin in the standard library do). (Is this a good idea?)
  • Support enabling raw mode on MSYS/Cygwin.

Inspiration

This crate draws inspiration from many great resources, such as:

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions

Dependencies

~0–8MB
~53K SLoC