Initial verison of PrettyPrinter builder

This commit is contained in:
sharkdp
2020-04-21 19:08:19 +02:00
committed by David Peter
parent 319ab779ee
commit 27974616bf
4 changed files with 53 additions and 16 deletions

View File

@ -1,22 +1,12 @@
/// A simple program that prints its own source code using the bat library
use bat::{
config::{Config, InputFile, OrdinaryFile},
Controller, HighlightingAssets,
};
use bat::PrettyPrinter;
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");
PrettyPrinter::new()
.file(path_to_this_file)
.run()
.expect("no errors");
}