Simpler highlight method

This commit is contained in:
sharkdp
2020-04-22 22:50:57 +02:00
committed by David Peter
parent 261a7ea154
commit 17f3a3b95d
3 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/// A program that prints its own source code using the bat library
use bat::{LineRange, PagingMode, PrettyPrinter, WrappingMode};
use bat::{PagingMode, PrettyPrinter, WrappingMode};
fn main() {
PrettyPrinter::new()
@ -8,7 +8,7 @@ fn main() {
.line_numbers(true)
.use_italics(true)
// The following line will be highlighted in the output:
.highlight(LineRange::new(line!() as usize, line!() as usize))
.highlight(line!() as usize)
.theme("1337")
.wrapping_mode(WrappingMode::Character)
.paging_mode(PagingMode::QuitIfOneScreen)