#io #tty #process #readable #writable #terminal #write

terminal-trx

Provides a handle to the terminal of the current process

5 releases

0.2.3 Aug 22, 2024
0.2.2 Jul 31, 2024
0.2.1 Jun 7, 2024
0.2.0 Feb 2, 2024
0.1.0 Jan 20, 2024

#159 in Command-line interface

Download history 1787/week @ 2024-08-16 1507/week @ 2024-08-23 1027/week @ 2024-08-30 1238/week @ 2024-09-06 707/week @ 2024-09-13 806/week @ 2024-09-20 641/week @ 2024-09-27 1196/week @ 2024-10-04 523/week @ 2024-10-11 636/week @ 2024-10-18 516/week @ 2024-10-25 679/week @ 2024-11-01 1405/week @ 2024-11-08 1610/week @ 2024-11-15 1047/week @ 2024-11-22 1203/week @ 2024-11-29

5,353 downloads per month
Used in 2 crates (via terminal-colorsaurus)

MIT/Apache

43KB
905 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
~57K SLoC