summaryrefslogtreecommitdiffstats
path: root/examples/simple.rs
blob: a0d7afa1fca3154f44a24d0accfc722fa5e07cb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/// A simple program that prints its own source code using the bat library
use bat::{
    config::{Config, InputFile, OrdinaryFile},
    Controller, HighlightingAssets,
};
use std::ffi::OsStr;

fn main() {
    let path_to_this_file = OsStr::new(file!());

    let config = Config {
        files: vec![InputFile::Ordinary(OrdinaryFile::from_path(
            path_to_this_file,
        ))],
        colored_output: true,
        true_color: true,
        ..Default::default()
    };
    let assets = HighlightingAssets::from_binary();

    Controller::new(&config, &assets).run().expect("no errors");
}