bat/examples/cat.rs

18 lines
524 B
Rust
Raw Normal View History

2020-03-21 21:45:03 +01:00
/// A very simple colorized `cat` clone, using `bat` as a library.
/// See `src/bin/bat` for the full `bat` application.
2020-04-22 20:35:05 +02:00
use bat::{PrettyPrinter, StyleComponent};
2020-03-21 21:45:03 +01:00
use console::Term;
fn main() {
2020-04-21 21:29:47 +02:00
PrettyPrinter::new()
.term_width(Term::stdout().size().1 as usize)
2020-04-22 20:35:05 +02:00
.style_components(&[
2020-03-21 21:45:03 +01:00
StyleComponent::Header,
StyleComponent::Grid,
2020-04-22 20:36:20 +02:00
StyleComponent::LineNumbers,
2020-04-22 20:35:05 +02:00
])
2020-04-21 21:29:47 +02:00
.input_files(std::env::args_os().skip(1))
2020-04-22 20:33:19 +02:00
.print()
2020-04-21 21:29:47 +02:00
.expect("no errors");
2020-03-21 21:45:03 +01:00
}