dev-cmd/cat: support setting bat theme via environment variable

This commit is contained in:
Kid 2022-06-06 08:39:18 +08:00
parent 6b3eb93010
commit 721a27d68d
5 changed files with 20 additions and 1 deletions

View File

@ -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 <formula>/<cask> source",

View File

@ -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).",

View File

@ -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

View File

@ -1953,6 +1953,11 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Default:* `$HOME/.config/bat/config`.
- `HOMEBREW_BAT_THEME`
<br>Use this as the `bat` theme for syntax highlighting.
*Default:* `$BAT_THEME`.
- `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).

View File

@ -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