Merge pull request #8693 from MikeMcQuaid/update_report_only_installed

Add HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED
This commit is contained in:
Mike McQuaid 2020-09-11 12:59:55 +01:00 committed by GitHub
commit dd1967c3e5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 87 additions and 66 deletions

View File

@ -456,22 +456,32 @@ class ReporterHub
private private
def dump_formula_report(key, title) def dump_formula_report(key, title)
only_installed = Homebrew::EnvConfig.update_report_only_installed?
formulae = select_formula(key).sort.map do |name, new_name| formulae = select_formula(key).sort.map do |name, new_name|
# Format list items of renamed formulae # Format list items of renamed formulae
case key case key
when :R when :R
name = pretty_installed(name) if installed?(name) name = pretty_installed(name) if installed?(name)
new_name = pretty_installed(new_name) if installed?(new_name) new_name = pretty_installed(new_name) if installed?(new_name)
"#{name} -> #{new_name}" "#{name} -> #{new_name}" unless only_installed
when :A when :A
name unless installed?(name) name if !installed?(name) && !only_installed
when :AC when :AC
name.split("/").last unless cask_installed?(name) name.split("/").last if !cask_installed?(name) && !only_installed
when :MC, :DC when :MC, :DC
name = name.split("/").last name = name.split("/").last
cask_installed?(name) ? pretty_installed(name) : name if cask_installed?(name)
pretty_installed(name)
elsif !only_installed
name
end
else else
installed?(name) ? pretty_installed(name) : name if installed?(name)
pretty_installed(name)
elsif !only_installed
name
end
end end
end.compact end.compact

View File

@ -259,6 +259,10 @@ module Homebrew
default_text: "macOS: `/private/tmp`, Linux: `/tmp`.", default_text: "macOS: `/private/tmp`, Linux: `/tmp`.",
default: HOMEBREW_DEFAULT_TEMP, default: HOMEBREW_DEFAULT_TEMP,
}, },
HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED: {
description: "If set, `brew update` only outputs updates to installed software.",
boolean: true,
},
HOMEBREW_UPDATE_TO_TAG: { HOMEBREW_UPDATE_TO_TAG: {
description: "If set, always use the latest stable tag (even if developer commands " \ description: "If set, always use the latest stable tag (even if developer commands " \
"have been run).", "have been run).",

View File

@ -1703,6 +1703,9 @@ For example, you might add something like the following to your ~/.profile, ~/.b
*Default:* macOS: `/private/tmp`, Linux: `/tmp`. *Default:* macOS: `/private/tmp`, Linux: `/tmp`.
* `HOMEBREW_UPDATE_REPORT_ONLY_INSTALLED`:
If set, `brew update` only outputs updates to installed software.
* `HOMEBREW_UPDATE_TO_TAG`: * `HOMEBREW_UPDATE_TO_TAG`:
If set, always use the latest stable tag (even if developer commands have been run). If set, always use the latest stable tag (even if developer commands have been run).

View File

@ -2345,6 +2345,10 @@ Use this path as the temporary directory for building packages\. Changing this m
\fIDefault:\fR macOS: \fB/private/tmp\fR, Linux: \fB/tmp\fR\. \fIDefault:\fR macOS: \fB/private/tmp\fR, Linux: \fB/tmp\fR\.
. .
.TP .TP
\fBHOMEBREW_UPDATE_REPORT_ONLY_INSTALLED\fR
If set, \fBbrew update\fR only outputs updates to installed software\.
.
.TP
\fBHOMEBREW_UPDATE_TO_TAG\fR \fBHOMEBREW_UPDATE_TO_TAG\fR
If set, always use the latest stable tag (even if developer commands have been run)\. If set, always use the latest stable tag (even if developer commands have been run)\.
. .