Merge pull request #7488 from danielbayley/master

cat: Allow 'bat' to find existing configuration
This commit is contained in:
Mike McQuaid 2020-06-12 10:45:11 +01:00 committed by GitHub
commit ae7e58ef78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 1 deletions

View File

@ -10,7 +10,12 @@ module Cask
def run
casks.each do |cask|
puts File.open(cask.sourcefile_path, &:read)
if Homebrew::EnvConfig.bat?
ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
safe_system "#{HOMEBREW_PREFIX}/bin/bat", cask.sourcefile_path
else
puts File.open(cask.sourcefile_path, &:read)
end
end
end

View File

@ -21,6 +21,7 @@ module Homebrew
cd HOMEBREW_REPOSITORY
pager = if Homebrew::EnvConfig.bat?
ENV["BAT_CONFIG_PATH"] = Homebrew::EnvConfig.bat_config_path
"#{HOMEBREW_PREFIX}/bin/bat"
else
"cat"

View File

@ -23,6 +23,10 @@ module Homebrew
description: "If set, use `bat` for the `brew cat` command.",
boolean: true,
},
HOMEBREW_BAT_CONFIG_PATH: {
description: "Use the `bat` configuration file. For example, `HOMEBREW_BAT=$HOME/.bat/config`.",
default_text: "$HOME/.bat/config",
},
HOMEBREW_BINTRAY_KEY: {
description: "Use this API key when accessing the Bintray API (where bottles are stored).",
},

View File

@ -1281,6 +1281,11 @@ Note that environment variables must have a value set to be detected. For exampl
* `HOMEBREW_BAT`:
If set, use `bat` for the `brew cat` command.
* `HOMEBREW_BAT_CONFIG_PATH`:
Use the `bat` configuration file. For example, `HOMEBREW_BAT=$HOME/.bat/config`.
*Default:* $HOME/.bat/config
* `HOMEBREW_BINTRAY_KEY`:
Use this API key when accessing the Bintray API (where bottles are stored).

View File

@ -1637,6 +1637,13 @@ Automatically check for updates once per this seconds interval\.
If set, use \fBbat\fR for the \fBbrew cat\fR command\.
.
.TP
\fBHOMEBREW_BAT_CONFIG_PATH\fR
Use the \fBbat\fR configuration file\. For example, \fBHOMEBREW_BAT=$HOME/\.bat/config\fR\.
.
.IP
\fIDefault:\fR $HOME/\.bat/config
.
.TP
\fBHOMEBREW_BINTRAY_KEY\fR
Use this API key when accessing the Bintray API (where bottles are stored)\.
.