mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-21 23:33:26 +01:00
Add ANSI stripping to bat-as-a-library
This commit is contained in:
parent
9e8176b1c6
commit
3f22311ec8
@ -11,7 +11,7 @@ use crate::{
|
||||
input,
|
||||
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||
style::StyleComponent,
|
||||
SyntaxMapping, WrappingMode,
|
||||
StripAnsiMode, SyntaxMapping, WrappingMode,
|
||||
};
|
||||
|
||||
#[cfg(feature = "paging")]
|
||||
@ -182,6 +182,15 @@ impl<'a> PrettyPrinter<'a> {
|
||||
self
|
||||
}
|
||||
|
||||
/// Whether to remove ANSI escape sequences from the input (default: never)
|
||||
///
|
||||
/// If `Auto` is used, escape sequences will only be removed when the input
|
||||
/// is not plain text.
|
||||
pub fn strip_ansi(&mut self, mode: StripAnsiMode) -> &mut Self {
|
||||
self.config.strip_ansi = mode;
|
||||
self
|
||||
}
|
||||
|
||||
/// Text wrapping mode (default: do not wrap)
|
||||
pub fn wrapping_mode(&mut self, mode: WrappingMode) -> &mut Self {
|
||||
self.config.wrapping_mode = mode;
|
||||
|
Loading…
Reference in New Issue
Block a user