Skip to content

Commit

Permalink
Add example to show new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Piturnah committed Jul 9, 2023
1 parent 4b6b86f commit 42f18bf
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions examples/buffer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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}");
}

0 comments on commit 42f18bf

Please sign in to comment.