bat/examples/advanced.rs

18 lines
539 B
Rust
Raw Normal View History

2020-04-22 19:16:40 +00: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 19:21:47 +00:00
.input_file(file!())
2020-04-22 19:16:40 +00:00
.print()
.expect("no errors");
}