ansi4tui

Crates.ioansi4tui
lib.rsansi4tui
version0.2.0
sourcesrc
created_at2020-10-27 04:11:36.542086
updated_at2021-02-19 05:33:14.738853
descriptionANSI terminal code to TUI Text Style converter
homepage
repositoryhttps://github.com/bmhenry/ansi4tui
max_upload_size
id305852
size30,913
Brandon Henry (bmhenry)

documentation

https://docs.rs/ansi4tui/

README

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.

Commit count: 8

cargo fmt