mirror of
https://github.com/sharkdp/bat.git
synced 2025-04-07 19:30:36 +01:00
23 lines
581 B
Rust
23 lines
581 B
Rust
use bat::{
|
|
assets::HighlightingAssets, config::Config, controller::Controller, output::OutputHandle, 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(OutputHandle::FmtWrite(&mut buffer)),
|
|
)
|
|
.unwrap();
|
|
|
|
println!("{buffer}");
|
|
}
|