mirror of
https://github.com/sharkdp/bat
synced 2026-07-29 18:01:43 +00:00
Add --strip-ansi=auto option
When using `auto`, escape sequences will be stripped unless printing plain text.
This commit is contained in:
@@ -250,6 +250,7 @@ impl App {
|
||||
{
|
||||
Some("never") => StripAnsiMode::Never,
|
||||
Some("always") => StripAnsiMode::Always,
|
||||
Some("auto") => StripAnsiMode::Auto,
|
||||
_ => unreachable!("other values for --strip-ansi are not allowed"),
|
||||
},
|
||||
theme: self
|
||||
|
||||
@@ -407,11 +407,13 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.long("strip-ansi")
|
||||
.overrides_with("strip-ansi")
|
||||
.value_name("when")
|
||||
.value_parser(["always", "never"])
|
||||
.value_parser(["auto", "always", "never"])
|
||||
.default_value("never")
|
||||
.hide_default_value(true)
|
||||
.help("Strip colors from the input (always, *never*)")
|
||||
.long_help("Specify when to strip ANSI escape sequences from the input. Possible values: always, *never*.")
|
||||
.help("Strip colors from the input (auto, always, *never*)")
|
||||
.long_help("Specify when to strip ANSI escape sequences from the input. \
|
||||
The automatic mode will remove escape sequences unless the syntax highlighting \
|
||||
language is plain text. Possible values: auto, always, *never*.")
|
||||
.hide_short_help(true)
|
||||
)
|
||||
.arg(
|
||||
|
||||
Reference in New Issue
Block a user