Add paging to advanced example

This commit is contained in:
sharkdp 2020-04-22 21:53:01 +02:00 committed by David Peter
parent 12eee0c590
commit cba9df746e
2 changed files with 5 additions and 1 deletions

View file

@ -1,5 +1,5 @@
/// A program that prints its own source code using the bat library
use bat::{LineRange, PrettyPrinter, WrappingMode};
use bat::{LineRange, PrettyPrinter, WrappingMode, PagingMode};
fn main() {
PrettyPrinter::new()
@ -11,6 +11,7 @@ fn main() {
.highlight(LineRange::new(line!() as usize, line!() as usize))
.theme("1337")
.wrapping_mode(WrappingMode::Character)
.paging_mode(PagingMode::QuitIfOneScreen)
.input_file(file!())
.print()
.unwrap();

View file

@ -41,3 +41,6 @@ pub use line_range::LineRange;
pub use pretty_printer::PrettyPrinter;
pub use syntax_mapping::{MappingTarget, SyntaxMapping};
pub use wrapping::WrappingMode;
#[cfg(feature = "paging")]
pub use config::PagingMode;