[][src]Struct bat::PrettyPrinter

pub struct PrettyPrinter<'a> { /* fields omitted */ }

Methods

impl<'a> PrettyPrinter<'a>[src]

pub fn new() -> Self[src]

pub fn input_file(&mut self, path: impl AsRef<OsStr>) -> &mut Self[src]

Add a file which should be pretty-printed

pub fn input_files<I, P>(&mut self, paths: I) -> &mut Self where
    I: IntoIterator<Item = P>,
    P: AsRef<OsStr>, 
[src]

Add multiple files which should be pretty-printed

pub fn input_stdin(&mut self) -> &mut Self[src]

Add STDIN as an input

pub fn input_stdin_with_name(&mut self, name: impl AsRef<OsStr>) -> &mut Self[src]

Add STDIN as an input (with customized name)

pub fn input_from_bytes(&mut self, content: &'a [u8]) -> &mut Self[src]

Add a byte string as an input

pub fn input_from_bytes_with_name(
    &mut self,
    content: &'a [u8],
    name: impl AsRef<OsStr>
) -> &mut Self
[src]

Add a byte string as an input (with customized name)

pub fn input_from_reader<R: Read + 'a>(&mut self, reader: R) -> &mut Self[src]

Add a custom reader as an input

pub fn input_from_reader_with_name<R: Read + 'a>(
    &mut self,
    reader: R,
    name: impl AsRef<OsStr>
) -> &mut Self
[src]

Add a custom reader as an input (with customized name)

pub fn language(&mut self, language: &'a str) -> &mut Self[src]

Specify the syntax file which should be used (default: auto-detect)

pub fn term_width(&mut self, width: usize) -> &mut Self[src]

The character width of the terminal (default: autodetect)

pub fn tab_width(&mut self, tab_width: Option<usize>) -> &mut Self[src]

The width of tab characters (default: None - do not turn tabs to spaces)

pub fn colored_output(&mut self, yes: bool) -> &mut Self[src]

Whether or not the output should be colorized (default: true)

pub fn true_color(&mut self, yes: bool) -> &mut Self[src]

Whether or not to output 24bit colors (default: true)

pub fn header(&mut self, yes: bool) -> &mut Self[src]

Whether to show a header with the file name

pub fn line_numbers(&mut self, yes: bool) -> &mut Self[src]

Whether to show line numbers

pub fn grid(&mut self, yes: bool) -> &mut Self[src]

Whether to paint a grid, separating line numbers, git changes and the code

pub fn vcs_modification_markers(&mut self, yes: bool) -> &mut Self[src]

Whether to show modification markers for VCS changes

pub fn snip(&mut self, yes: bool) -> &mut Self[src]

Whether to show "snip" markers between visible line ranges (default: no)

pub fn wrapping_mode(&mut self, mode: WrappingMode) -> &mut Self[src]

Text wrapping mode (default: do not wrap)

pub fn use_italics(&mut self, yes: bool) -> &mut Self[src]

Whether or not to use ANSI italics (default: off)

pub fn paging_mode(&mut self, mode: PagingMode) -> &mut Self[src]

If and how to use a pager (default: no paging)

pub fn pager(&mut self, cmd: &'a str) -> &mut Self[src]

Specify the command to start the pager (default: use "less")

pub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self[src]

Specify the lines that should be printed (default: all)

pub fn highlight(&mut self, line: usize) -> &mut Self[src]

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.

pub fn highlight_range(&mut self, from: usize, to: usize) -> &mut Self[src]

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.

pub fn theme(&mut self, theme: impl AsRef<str>) -> &mut Self[src]

Specify the highlighting theme

pub fn syntax_mapping(&mut self, mapping: SyntaxMapping<'a>) -> &mut Self[src]

Specify custom file extension / file name to syntax mappings

pub fn themes(&self) -> impl Iterator<Item = &str>[src]

pub fn syntaxes(&self) -> impl Iterator<Item = &SyntaxReference>[src]

pub fn print(&mut self) -> Result<bool>[src]

Pretty-print all specified inputs. This method will "use" all stored inputs. If you want to call 'print' multiple times, you have to call the appropriate input_* methods again.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for PrettyPrinter<'a>

impl<'a> !Send for PrettyPrinter<'a>

impl<'a> !Sync for PrettyPrinter<'a>

impl<'a> Unpin for PrettyPrinter<'a>

impl<'a> !UnwindSafe for PrettyPrinter<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.