1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-01-19 12:24:17 +00:00
bat/examples/buffer.rs

18 lines
493 B
Rust
Raw Normal View History

2023-07-09 01:49:45 +01:00
use bat::{assets::HighlightingAssets, config::Config, controller::Controller, Input};
fn main() {
let mut buffer = String::new();
let config = Config {
colored_output: true,
..Default::default()
};
let assets = HighlightingAssets::from_binary();
let controller = Controller::new(&config, &assets);
let input = Input::from_file(file!());
controller
.run(vec![input.into()], Some(&mut buffer))
.unwrap();
println!("{buffer}");
}