diff --git a/Library/Homebrew/dev-cmd/cat.rb b/Library/Homebrew/dev-cmd/cat.rb index 43d937c62e..3960e5518c 100644 --- a/Library/Homebrew/dev-cmd/cat.rb +++ b/Library/Homebrew/dev-cmd/cat.rb @@ -32,6 +32,7 @@ module Homebrew cd HOMEBREW_REPOSITORY pager = if Homebrew::EnvConfig.bat? ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path + ENV["BAT_THEME"] = Homebrew::EnvConfig.bat_theme ensure_formula_installed!( "bat", reason: "displaying / source", diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb index 9ae1583801..f82c827bbc 100644 --- a/Library/Homebrew/env_config.rb +++ b/Library/Homebrew/env_config.rb @@ -44,6 +44,10 @@ module Homebrew description: "Use this as the `bat` configuration file.", 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: { 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).", diff --git a/bin/brew b/bin/brew index ace5a7cfee..4c06f135a0 100755 --- a/bin/brew +++ b/bin/brew @@ -75,7 +75,7 @@ HOMEBREW_LIBRARY="${HOMEBREW_REPOSITORY}/Library" # Copy and export all HOMEBREW_* variables previously mentioned in # 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 # Skip if variable value is empty. [[ -z "${!VAR}" ]] && continue diff --git a/docs/Manpage.md b/docs/Manpage.md index 7ea53ad19d..bde9ca5e5a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1953,6 +1953,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just *Default:* `$HOME/.config/bat/config`. +- `HOMEBREW_BAT_THEME` +
Use this as the `bat` theme for syntax highlighting. + + *Default:* `$BAT_THEME`. + - `HOMEBREW_BOOTSNAP`
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). diff --git a/manpages/brew.1 b/manpages/brew.1 index 5b2df57914..6014cb25fe 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -2772,6 +2772,15 @@ Use this as the \fBbat\fR configuration file\. \fIDefault:\fR \fB$HOME/\.config/bat/config\fR\. . .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 . .br