2
0
mirror of https://github.com/sharkdp/bat synced 2024-11-18 15:26:16 +00:00
bat/examples/advanced.rs

19 lines
545 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
2020-04-22 20:50:57 +00:00
use bat::{PagingMode, PrettyPrinter, WrappingMode};
2020-04-22 19:16:40 +00: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 20:50:57 +00:00
.highlight(line!() as usize)
2020-04-22 19:16:40 +00:00
.theme("1337")
.wrapping_mode(WrappingMode::Character)
2020-04-22 19:53:01 +00:00
.paging_mode(PagingMode::QuitIfOneScreen)
2020-04-22 19:21:47 +00:00
.input_file(file!())
2020-04-22 19:16:40 +00:00
.print()
2020-04-22 19:46:01 +00:00
.unwrap();
2020-04-22 19:16:40 +00:00
}