Merge pull request #13385 from kidonng/HOMEBREW_BAT_THEME
dev-cmd/cat: support setting bat theme via environment variable
This commit is contained in:
		
						commit
						ddaf011b4f
					
				@ -32,6 +32,7 @@ module Homebrew
 | 
				
			|||||||
    cd HOMEBREW_REPOSITORY
 | 
					    cd HOMEBREW_REPOSITORY
 | 
				
			||||||
    pager = if Homebrew::EnvConfig.bat?
 | 
					    pager = if Homebrew::EnvConfig.bat?
 | 
				
			||||||
      ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
 | 
					      ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
 | 
				
			||||||
 | 
					      ENV["BAT_THEME"] = Homebrew::EnvConfig.bat_theme
 | 
				
			||||||
      ensure_formula_installed!(
 | 
					      ensure_formula_installed!(
 | 
				
			||||||
        "bat",
 | 
					        "bat",
 | 
				
			||||||
        reason:           "displaying <formula>/<cask> source",
 | 
					        reason:           "displaying <formula>/<cask> source",
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,10 @@ module Homebrew
 | 
				
			|||||||
        description:  "Use this as the `bat` configuration file.",
 | 
					        description:  "Use this as the `bat` configuration file.",
 | 
				
			||||||
        default_text: "`$HOME/.config/bat/config`.",
 | 
					        default_text: "`$HOME/.config/bat/config`.",
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      HOMEBREW_BAT_THEME:                        {
 | 
				
			||||||
 | 
					        description:  "Use this as the `bat` theme for syntax highlighting.",
 | 
				
			||||||
 | 
					        default_text: "`$BAT_THEME`.",
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
      HOMEBREW_BOOTSNAP:                         {
 | 
					      HOMEBREW_BOOTSNAP:                         {
 | 
				
			||||||
        description: "If set, use Bootsnap to speed up repeated `brew` calls. "\
 | 
					        description: "If set, use Bootsnap to speed up repeated `brew` calls. "\
 | 
				
			||||||
                     "A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).",
 | 
					                     "A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										2
									
								
								bin/brew
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								bin/brew
									
									
									
									
									
								
							@ -75,7 +75,7 @@ HOMEBREW_LIBRARY="${HOMEBREW_REPOSITORY}/Library"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Copy and export all HOMEBREW_* variables previously mentioned in
 | 
					# Copy and export all HOMEBREW_* variables previously mentioned in
 | 
				
			||||||
# manpage or used elsewhere by Homebrew.
 | 
					# manpage or used elsewhere by Homebrew.
 | 
				
			||||||
for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH TMUX DBUS_SESSION_BUS_ADDRESS
 | 
					for VAR in BAT_THEME BROWSER DISPLAY EDITOR NO_COLOR PATH TMUX DBUS_SESSION_BUS_ADDRESS
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
  # Skip if variable value is empty.
 | 
					  # Skip if variable value is empty.
 | 
				
			||||||
  [[ -z "${!VAR}" ]] && continue
 | 
					  [[ -z "${!VAR}" ]] && continue
 | 
				
			||||||
 | 
				
			|||||||
@ -1953,6 +1953,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  *Default:* `$HOME/.config/bat/config`.
 | 
					  *Default:* `$HOME/.config/bat/config`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- `HOMEBREW_BAT_THEME`
 | 
				
			||||||
 | 
					  <br>Use this as the `bat` theme for syntax highlighting.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  *Default:* `$BAT_THEME`.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- `HOMEBREW_BOOTSNAP`
 | 
					- `HOMEBREW_BOOTSNAP`
 | 
				
			||||||
  <br>If set, use Bootsnap to speed up repeated `brew` calls. A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).
 | 
					  <br>If set, use Bootsnap to speed up repeated `brew` calls. A no-op when using Homebrew's vendored, relocatable Ruby on macOS (as it doesn't work).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -2772,6 +2772,15 @@ Use this as the \fBbat\fR configuration file\.
 | 
				
			|||||||
\fIDefault:\fR \fB$HOME/\.config/bat/config\fR\.
 | 
					\fIDefault:\fR \fB$HOME/\.config/bat/config\fR\.
 | 
				
			||||||
.
 | 
					.
 | 
				
			||||||
.TP
 | 
					.TP
 | 
				
			||||||
 | 
					\fBHOMEBREW_BAT_THEME\fR
 | 
				
			||||||
 | 
					.
 | 
				
			||||||
 | 
					.br
 | 
				
			||||||
 | 
					Use this as the \fBbat\fR theme for syntax highlighting\.
 | 
				
			||||||
 | 
					.
 | 
				
			||||||
 | 
					.IP
 | 
				
			||||||
 | 
					\fIDefault:\fR \fB$BAT_THEME\fR\.
 | 
				
			||||||
 | 
					.
 | 
				
			||||||
 | 
					.TP
 | 
				
			||||||
\fBHOMEBREW_BOOTSNAP\fR
 | 
					\fBHOMEBREW_BOOTSNAP\fR
 | 
				
			||||||
.
 | 
					.
 | 
				
			||||||
.br
 | 
					.br
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user