summaryrefslogtreecommitdiffstats
path: root/examples/cat.rs
blob: 9171e6ad99ee6d21fcb8078a6f958f055b84d1cd (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};
use console::Term;

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