1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-08-08 15:34:46 +02:00
Files
.cargo
.github
assets
build
diagnostics
doc
examples
advanced.rs
buffer.rs
cat.rs
inputs.rs
list_syntaxes_and_themes.rs
simple.rs
yaml.rs
src
tests
.gitignore
.gitmodules
CHANGELOG.md
CONTRIBUTING.md
Cargo.lock
Cargo.toml
LICENSE-APACHE
LICENSE-MIT
NOTICE
README.md
rustfmt.toml
bat/examples/buffer.rs
2023-09-01 20:52:55 +02:00

18 lines
493 B
Rust

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}");
}