bat/examples/advanced.rs

18 lines
528 B
Rust
Raw Normal View History

2020-04-22 21:16:40 +02:00
/// A program that prints its own source code using the bat library
use bat::{LineRange, PrettyPrinter, WrappingMode};
fn main() {
PrettyPrinter::new()
.header(true)
.grid(true)
.line_numbers(true)
.use_italics(true)
// The following line will be highlighted in the output:
.highlight(LineRange::new(line!() as usize, line!() as usize))
.theme("1337")
.wrapping_mode(WrappingMode::Character)
2020-04-22 21:21:47 +02:00
.input_file(file!())
2020-04-22 21:16:40 +02:00
.print()
2020-04-22 21:46:01 +02:00
.unwrap();
2020-04-22 21:16:40 +02:00
}