Struct bat::PrettyPrinter
source · pub struct PrettyPrinter<'a> { /* private fields */ }
Implementations§
source§impl<'a> PrettyPrinter<'a>
impl<'a> PrettyPrinter<'a>
pub fn new() -> Self
sourcepub fn input(&mut self, input: Input<'a>) -> &mut Self
pub fn input(&mut self, input: Input<'a>) -> &mut Self
Add an input which should be pretty-printed
sourcepub fn inputs(
&mut self,
inputs: impl IntoIterator<Item = Input<'a>>
) -> &mut Self
pub fn inputs( &mut self, inputs: impl IntoIterator<Item = Input<'a>> ) -> &mut Self
Adds multiple inputs which should be pretty-printed
sourcepub fn input_file(&mut self, path: impl AsRef<Path>) -> &mut Self
pub fn input_file(&mut self, path: impl AsRef<Path>) -> &mut Self
Add a file which should be pretty-printed
sourcepub fn input_files<I, P>(&mut self, paths: I) -> &mut Selfwhere
I: IntoIterator<Item = P>,
P: AsRef<Path>,
pub fn input_files<I, P>(&mut self, paths: I) -> &mut Selfwhere I: IntoIterator<Item = P>, P: AsRef<Path>,
Add multiple files which should be pretty-printed
sourcepub fn input_stdin(&mut self) -> &mut Self
pub fn input_stdin(&mut self) -> &mut Self
Add STDIN as an input
sourcepub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self
pub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self
Add a byte string as an input
sourcepub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self
pub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self
Add a custom reader as an input
sourcepub fn language(&mut self, language: &'a str) -> &mut Self
pub fn language(&mut self, language: &'a str) -> &mut Self
Specify the syntax file which should be used (default: auto-detect)
sourcepub fn term_width(&mut self, width: usize) -> &mut Self
pub fn term_width(&mut self, width: usize) -> &mut Self
The character width of the terminal (default: autodetect)
sourcepub fn tab_width(&mut self, tab_width: Option<usize>) -> &mut Self
pub fn tab_width(&mut self, tab_width: Option<usize>) -> &mut Self
The width of tab characters (default: None - do not turn tabs to spaces)
sourcepub fn colored_output(&mut self, yes: bool) -> &mut Self
pub fn colored_output(&mut self, yes: bool) -> &mut Self
Whether or not the output should be colorized (default: true)
sourcepub fn true_color(&mut self, yes: bool) -> &mut Self
pub fn true_color(&mut self, yes: bool) -> &mut Self
Whether or not to output 24bit colors (default: true)
sourcepub fn line_numbers(&mut self, yes: bool) -> &mut Self
pub fn line_numbers(&mut self, yes: bool) -> &mut Self
Whether to show line numbers
sourcepub fn grid(&mut self, yes: bool) -> &mut Self
pub fn grid(&mut self, yes: bool) -> &mut Self
Whether to paint a grid, separating line numbers, git changes and the code
sourcepub fn rule(&mut self, yes: bool) -> &mut Self
pub fn rule(&mut self, yes: bool) -> &mut Self
Whether to paint a horizontal rule to delimit files
sourcepub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self
pub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self
Whether to show modification markers for VCS changes. This has no effect if
the git
feature is not activated.
sourcepub fn show_nonprintable(&mut self, yes: bool) -> &mut Self
pub fn show_nonprintable(&mut self, yes: bool) -> &mut Self
Whether to print binary content or nonprintable characters (default: no)
sourcepub fn snip(&mut self, yes: bool) -> &mut Self
pub fn snip(&mut self, yes: bool) -> &mut Self
Whether to show “snip” markers between visible line ranges (default: no)
sourcepub fn wrapping_mode(&mut self, mode: WrappingMode) -> &mut Self
pub fn wrapping_mode(&mut self, mode: WrappingMode) -> &mut Self
Text wrapping mode (default: do not wrap)
sourcepub fn use_italics(&mut self, yes: bool) -> &mut Self
pub fn use_italics(&mut self, yes: bool) -> &mut Self
Whether or not to use ANSI italics (default: off)
sourcepub fn paging_mode(&mut self, mode: PagingMode) -> &mut Self
pub fn paging_mode(&mut self, mode: PagingMode) -> &mut Self
If and how to use a pager (default: no paging)
sourcepub fn pager(&mut self, cmd: &'a str) -> &mut Self
pub fn pager(&mut self, cmd: &'a str) -> &mut Self
Specify the command to start the pager (default: use “less”)
sourcepub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self
pub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self
Specify the lines that should be printed (default: all)
sourcepub fn highlight(&mut self, line: usize) -> &mut Self
pub fn highlight(&mut self, line: usize) -> &mut Self
Specify a line that should be highlighted (default: none). This can be called multiple times to highlight more than one line. See also: highlight_range.
sourcepub fn highlight_range(&mut self, from: usize, to: usize) -> &mut Self
pub fn highlight_range(&mut self, from: usize, to: usize) -> &mut Self
Specify a range of lines that should be highlighted (default: none). This can be called multiple times to highlight more than one range of lines.
sourcepub fn syntax_mapping(&mut self, mapping: SyntaxMapping<'a>) -> &mut Self
pub fn syntax_mapping(&mut self, mapping: SyntaxMapping<'a>) -> &mut Self
Specify custom file extension / file name to syntax mappings