bat/examples/advanced.rs

19 lines
545 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
2020-04-22 22:50:57 +02:00
use bat::{PagingMode, PrettyPrinter, WrappingMode};
2020-04-22 21:16:40 +02:00
fn main() {
PrettyPrinter::new()
.header(true)
.grid(true)
.line_numbers(true)
.use_italics(true)
// The following line will be highlighted in the output:
2020-04-22 22:50:57 +02:00
.highlight(line!() as usize)
2020-04-22 21:16:40 +02:00
.theme("1337")
.wrapping_mode(WrappingMode::Character)
2020-04-22 21:53:01 +02:00
.paging_mode(PagingMode::QuitIfOneScreen)
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
}