mirror of
				https://github.com/sharkdp/bat.git
				synced 2025-11-04 09:01:56 +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:
		
				
					committed by
					
						
						David Peter
					
				
			
			
				
	
			
			
			
						parent
						
							dc10246bd2
						
					
				
				
					commit
					18d1a3b973
				
			@@ -77,7 +77,7 @@ pub struct Config<'a> {
 | 
			
		||||
    /// Command to start the pager
 | 
			
		||||
    pub pager: Option<&'a str>,
 | 
			
		||||
 | 
			
		||||
    pub italics: bool,
 | 
			
		||||
    pub use_italic_text: bool,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fn is_truecolor_terminal() -> bool {
 | 
			
		||||
@@ -260,7 +260,7 @@ impl App {
 | 
			
		||||
            output_components,
 | 
			
		||||
            syntax_mapping,
 | 
			
		||||
            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,
 | 
			
		||||
                _ => false,
 | 
			
		||||
            },
 | 
			
		||||
 
 | 
			
		||||
@@ -202,6 +202,17 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
 | 
			
		||||
                     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::with_name("decorations")
 | 
			
		||||
                .long("decorations")
 | 
			
		||||
@@ -320,17 +331,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
 | 
			
		||||
                .hidden(true)
 | 
			
		||||
                .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::with_name("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 {
 | 
			
		||||
            let true_color = self.config.true_color;
 | 
			
		||||
            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() {
 | 
			
		||||
                let text = &*self.preprocess(region, &mut cursor_total);
 | 
			
		||||
@@ -368,7 +368,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
 | 
			
		||||
                                            ),
 | 
			
		||||
                                            self.config.true_color,
 | 
			
		||||
                                            self.config.colored_output,
 | 
			
		||||
                                            self.config.italics
 | 
			
		||||
                                            self.config.use_italic_text
 | 
			
		||||
                                        )
 | 
			
		||||
                                    )?;
 | 
			
		||||
                                    break;
 | 
			
		||||
@@ -408,7 +408,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
 | 
			
		||||
                                        ),
 | 
			
		||||
                                        self.config.true_color,
 | 
			
		||||
                                        self.config.colored_output,
 | 
			
		||||
                                        self.config.italics
 | 
			
		||||
                                        self.config.use_italic_text
 | 
			
		||||
                                    ),
 | 
			
		||||
                                    panel_wrap.clone().unwrap()
 | 
			
		||||
                                )?;
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ pub fn as_terminal_escaped(
 | 
			
		||||
            color.bold()
 | 
			
		||||
        } else if style.font_style.contains(FontStyle::UNDERLINE) {
 | 
			
		||||
            color.underline()
 | 
			
		||||
        } else if style.font_style.contains(FontStyle::ITALIC) && italics {
 | 
			
		||||
        } else if italics && style.font_style.contains(FontStyle::ITALIC) {
 | 
			
		||||
            color.italic()
 | 
			
		||||
        } else {
 | 
			
		||||
            color.normal()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user