summaryrefslogtreecommitdiffstats
path: root/examples/cat.rs
blob: c1c9b242ca668dd97bf579cf1a127c4841be68e3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
/// A very simple colorized `cat` clone, using `bat` as a library.
/// See `src/bin/bat` for the full `bat` application.
use bat::{PrettyPrinter, StyleComponent, StyleComponents};
use console::Term;

fn main() {
    PrettyPrinter::new()
        .term_width(Term::stdout().size().1 as usize)
        .style_components(StyleComponents::new(&[
            StyleComponent::Header,
            StyleComponent::Grid,
            StyleComponent::Numbers,
        ]))
        .input_files(std::env::args_os().skip(1))
        .run()
        .expect("no errors");
}