blob: 51bebe567b9e70a988b504be1c511c9051c859ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
use std::io::{self, BufRead};
#[cfg(not(tarpaulin_include))]
pub fn parse_ansi() -> std::io::Result<()> {
use crate::{ansi, style::Style};
for line in io::stdin().lock().lines() {
for (ansi_term_style, s) in ansi::parse_style_sections(
&line.unwrap_or_else(|line| panic!("Invalid utf-8: {:?}", line)),
) {
let style = Style {
ansi_term_style,
..Style::default()
};
print!("({}){}", style.to_painted_string(), style.paint(s));
}
println!();
}
Ok(())
}
|