1
0
mirror of https://github.com/sharkdp/bat.git synced 2024-10-06 02:41:06 +01:00
bat/examples/advanced.rs

19 lines
545 B
Rust
Raw Normal View History

2020-04-22 20:16:40 +01:00
/// A program that prints its own source code using the bat library
2020-04-22 21:50:57 +01:00
use bat::{PagingMode, PrettyPrinter, WrappingMode};
2020-04-22 20:16:40 +01: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 21:50:57 +01:00
.highlight(line!() as usize)
2020-04-22 20:16:40 +01:00
.theme("1337")
.wrapping_mode(WrappingMode::Character)
2020-04-22 20:53:01 +01:00
.paging_mode(PagingMode::QuitIfOneScreen)
2020-04-22 20:21:47 +01:00
.input_file(file!())
2020-04-22 20:16:40 +01:00
.print()
2020-04-22 20:46:01 +01:00
.unwrap();
2020-04-22 20:16:40 +01:00
}