From b31b14f7869c921f95f46d563ae13034113b5fe6 Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Sun, 29 Sep 2019 18:01:38 +0200 Subject: [PATCH 1/2] cat: use HOMEBREW_VISUAL as pager if set --- Library/Homebrew/cmd/cat.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 8075034046..15cd149d58 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -25,6 +25,7 @@ module Homebrew raise "`brew cat` doesn't support multiple arguments" if args.remaining.size > 1 cd HOMEBREW_REPOSITORY - safe_system "cat", formulae.first.path, *Homebrew.args.passthrough + pager = ENV["HOMEBREW_VISUAL"] || "cat" + safe_system pager, formulae.first.path, *Homebrew.args.passthrough end end From 25454a92570fe05bc19a4ab6a626fb594e55f12e Mon Sep 17 00:00:00 2001 From: Dawid Dziurla Date: Mon, 30 Sep 2019 15:40:20 +0200 Subject: [PATCH 2/2] cat: look for HOMEBREW_BAT --- Library/Homebrew/cmd/cat.rb | 6 +++++- Library/Homebrew/manpages/brew.1.md.erb | 3 +++ docs/Manpage.md | 3 +++ manpages/brew.1 | 6 +++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/cmd/cat.rb b/Library/Homebrew/cmd/cat.rb index 15cd149d58..c7f2f4c790 100644 --- a/Library/Homebrew/cmd/cat.rb +++ b/Library/Homebrew/cmd/cat.rb @@ -25,7 +25,11 @@ module Homebrew raise "`brew cat` doesn't support multiple arguments" if args.remaining.size > 1 cd HOMEBREW_REPOSITORY - pager = ENV["HOMEBREW_VISUAL"] || "cat" + pager = if ENV["HOMEBREW_BAT"].nil? + "cat" + else + "#{HOMEBREW_PREFIX}/bin/bat" + end safe_system pager, formulae.first.path, *Homebrew.args.passthrough end end diff --git a/Library/Homebrew/manpages/brew.1.md.erb b/Library/Homebrew/manpages/brew.1.md.erb index 114a3319fa..dc8875e61d 100644 --- a/Library/Homebrew/manpages/brew.1.md.erb +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -143,6 +143,9 @@ Note that environment variables must have a value set to be detected. For exampl to retrieve these access credentials from AWS). If they are not set, the `S3` download strategy will download with a public (unsigned) URL. + * `HOMEBREW_BAT`: + If set, Homebrew will use `bat` for the `brew cat` command. + * `HOMEBREW_BOTTLE_DOMAIN`: By default, Homebrew uses `https://homebrew.bintray.com/` as its download mirror for bottles. If set, instructs Homebrew to instead use the specified diff --git a/docs/Manpage.md b/docs/Manpage.md index e813202421..15e0c8323a 100644 --- a/docs/Manpage.md +++ b/docs/Manpage.md @@ -1077,6 +1077,9 @@ Note that environment variables must have a value set to be detected. For exampl to retrieve these access credentials from AWS). If they are not set, the `S3` download strategy will download with a public (unsigned) URL. + * `HOMEBREW_BAT`: + If set, Homebrew will use `bat` for the `brew cat` command. + * `HOMEBREW_BOTTLE_DOMAIN`: By default, Homebrew uses `https://homebrew.bintray.com/` as its download mirror for bottles. If set, instructs Homebrew to instead use the specified diff --git a/manpages/brew.1 b/manpages/brew.1 index 65c6a12013..3f68e32c24 100644 --- a/manpages/brew.1 +++ b/manpages/brew.1 @@ -1,7 +1,7 @@ .\" generated with Ronn/v0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3 . -.TH "BREW" "1" "September 2019" "Homebrew" "brew" +.TH "BREW" "1" "October 2019" "Homebrew" "brew" . .SH "NAME" \fBbrew\fR \- The missing package manager for macOS @@ -1336,6 +1336,10 @@ If set, Homebrew will only check for autoupdates once per this seconds interval\ When using the \fBS3\fR download strategy, Homebrew will look in these variables for access credentials (see \fIhttps://docs\.aws\.amazon\.com/cli/latest/userguide/cli\-chap\-getting\-started\.html#cli\-environment\fR to retrieve these access credentials from AWS)\. If they are not set, the \fBS3\fR download strategy will download with a public (unsigned) URL\. . .TP +\fBHOMEBREW_BAT\fR +If set, Homebrew will use \fBbat\fR for the \fBbrew cat\fR command\. +. +.TP \fBHOMEBREW_BOTTLE_DOMAIN\fR By default, Homebrew uses \fBhttps://homebrew\.bintray\.com/\fR as its download mirror for bottles\. If set, instructs Homebrew to instead use the specified URL\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. .