mirror of
https://github.com/sharkdp/bat.git
synced 2025-01-19 04:21:06 +00:00
Changed italics to use-italic-text in config
Better placing of italics in help and also added long_help for it
This commit is contained in:
parent
dc10246bd2
commit
18d1a3b973
@ -77,7 +77,7 @@ pub struct Config<'a> {
|
|||||||
/// Command to start the pager
|
/// Command to start the pager
|
||||||
pub pager: Option<&'a str>,
|
pub pager: Option<&'a str>,
|
||||||
|
|
||||||
pub italics: bool,
|
pub use_italic_text: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_truecolor_terminal() -> bool {
|
fn is_truecolor_terminal() -> bool {
|
||||||
@ -260,7 +260,7 @@ impl App {
|
|||||||
output_components,
|
output_components,
|
||||||
syntax_mapping,
|
syntax_mapping,
|
||||||
pager: self.matches.value_of("pager"),
|
pager: self.matches.value_of("pager"),
|
||||||
italics: match self.matches.value_of("italic-text") {
|
use_italic_text: match self.matches.value_of("italic-text") {
|
||||||
Some("always") => true,
|
Some("always") => true,
|
||||||
_ => false,
|
_ => false,
|
||||||
},
|
},
|
||||||
|
@ -202,6 +202,17 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
Possible values: *auto*, never, always.",
|
Possible values: *auto*, never, always.",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("italic-text")
|
||||||
|
.long("italic-text")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
|
.possible_values(&["always", "never"])
|
||||||
|
.default_value("never")
|
||||||
|
.hide_default_value(true)
|
||||||
|
.help("Use italics in output (always, *never*)")
|
||||||
|
.long_help("Specify when to use ANSI sequences for italic text in the output. Possible values: always, *never*."),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("decorations")
|
Arg::with_name("decorations")
|
||||||
.long("decorations")
|
.long("decorations")
|
||||||
@ -320,17 +331,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.hidden(true)
|
.hidden(true)
|
||||||
.help("Show path to the configuration file."),
|
.help("Show path to the configuration file."),
|
||||||
)
|
)
|
||||||
.arg(
|
|
||||||
Arg::with_name("italic-text")
|
|
||||||
.long("italic-text")
|
|
||||||
.takes_value(true)
|
|
||||||
.multiple(false)
|
|
||||||
.value_name("always|*never*")
|
|
||||||
.possible_values(&["always", "never"])
|
|
||||||
.default_value("never")
|
|
||||||
.hide_default_value(true)
|
|
||||||
.help("Use italics in output (always, *never*)"),
|
|
||||||
)
|
|
||||||
.subcommand(
|
.subcommand(
|
||||||
SubCommand::with_name("cache")
|
SubCommand::with_name("cache")
|
||||||
.about("Modify the syntax-definition and theme cache")
|
.about("Modify the syntax-definition and theme cache")
|
||||||
|
@ -305,7 +305,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
if self.config.output_wrap == OutputWrap::None {
|
if self.config.output_wrap == OutputWrap::None {
|
||||||
let true_color = self.config.true_color;
|
let true_color = self.config.true_color;
|
||||||
let colored_output = self.config.colored_output;
|
let colored_output = self.config.colored_output;
|
||||||
let italics = self.config.italics;
|
let italics = self.config.use_italic_text;
|
||||||
|
|
||||||
for &(style, region) in regions.iter() {
|
for &(style, region) in regions.iter() {
|
||||||
let text = &*self.preprocess(region, &mut cursor_total);
|
let text = &*self.preprocess(region, &mut cursor_total);
|
||||||
@ -368,7 +368,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
),
|
),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.italics
|
self.config.use_italic_text
|
||||||
)
|
)
|
||||||
)?;
|
)?;
|
||||||
break;
|
break;
|
||||||
@ -408,7 +408,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
),
|
),
|
||||||
self.config.true_color,
|
self.config.true_color,
|
||||||
self.config.colored_output,
|
self.config.colored_output,
|
||||||
self.config.italics
|
self.config.use_italic_text
|
||||||
),
|
),
|
||||||
panel_wrap.clone().unwrap()
|
panel_wrap.clone().unwrap()
|
||||||
)?;
|
)?;
|
||||||
|
@ -29,7 +29,7 @@ pub fn as_terminal_escaped(
|
|||||||
color.bold()
|
color.bold()
|
||||||
} else if style.font_style.contains(FontStyle::UNDERLINE) {
|
} else if style.font_style.contains(FontStyle::UNDERLINE) {
|
||||||
color.underline()
|
color.underline()
|
||||||
} else if style.font_style.contains(FontStyle::ITALIC) && italics {
|
} else if italics && style.font_style.contains(FontStyle::ITALIC) {
|
||||||
color.italic()
|
color.italic()
|
||||||
} else {
|
} else {
|
||||||
color.normal()
|
color.normal()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user