2 unstable releases
0.2.0 | Feb 19, 2021 |
---|---|
0.1.0 | Oct 27, 2020 |
#16 in #text-style
28 downloads per month
10KB
111 lines
ansi4tui
TUI doesn't natively support converting ANSI terminal codes to its own Style
abstraction, so this crate provides a simple (and probably naive) conversion method. It has not been rigorously tested.
Example
use std::process::Command;
let c = Command::new("ls")
.args(&["--color=always", "~"])
.output()
.unwrap();
let text = ansi4tui::bytes_to_text(c.stdout);
For a simple usage example, see the example file. You can run the example with cargo run --example simple
, and close the display by pressing q
. It assumes you're on a system with /etc/hosts
, so change the file if you want to run the example and that file isn't available.
lib.rs
:
Handles terminal ANSI -> TUI Style conversion
Example
use std::process::Command;
let c = Command::new("ls")
.args(&["--color=always", "~"])
.output()
.unwrap();
let text = ansi4tui::bytes_to_text(c.stdout);
Dependencies
~14MB
~292K SLoC