cmd/uninstall: Add env variable that runs autoremove after uninstalls
When HOMEBREW_UNINSTALL_AUTOREMOVE is set, `brew autoremove` is run after every successful call to `brew uninstall`.
This commit is contained in:
parent
40b20dea22
commit
f8ae5f3bc4
@ -50,6 +50,11 @@ module Homebrew
|
|||||||
all_kegs: args.force?,
|
all_kegs: args.force?,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# If ignore_unavailable is true and the named args
|
||||||
|
# are a series of invalid kegs and casks,
|
||||||
|
# #to_kegs_to_casks will return empty arrays.
|
||||||
|
return if all_kegs.blank? && casks.blank?
|
||||||
|
|
||||||
kegs_by_rack = all_kegs.group_by(&:rack)
|
kegs_by_rack = all_kegs.group_by(&:rack)
|
||||||
|
|
||||||
Uninstall.uninstall_kegs(
|
Uninstall.uninstall_kegs(
|
||||||
@ -73,5 +78,9 @@ module Homebrew
|
|||||||
force: args.force?,
|
force: args.force?,
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return unless Homebrew::EnvConfig.uninstall_autoremove?
|
||||||
|
|
||||||
|
system HOMEBREW_BREW_FILE, "autoremove"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -343,6 +343,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_UNINSTALL_AUTOREMOVE: {
|
||||||
|
description: "If set, `brew autoremove` is run after every successful call to `brew uninstall`.",
|
||||||
|
boolean: true,
|
||||||
|
},
|
||||||
HOMEBREW_UPDATE_REPORT_ALL_FORMULAE: {
|
HOMEBREW_UPDATE_REPORT_ALL_FORMULAE: {
|
||||||
description: "If set, `brew update` lists changes to all formulae and cask files rather than only showing " \
|
description: "If set, `brew update` lists changes to all formulae and cask files rather than only showing " \
|
||||||
"when they are new and not installed or outdated and installed.",
|
"when they are new and not installed or outdated and installed.",
|
||||||
|
@ -2572,6 +2572,8 @@ module Homebrew::EnvConfig
|
|||||||
|
|
||||||
def self.temp(); end
|
def self.temp(); end
|
||||||
|
|
||||||
|
def self.uninstall_autoremove?(); end
|
||||||
|
|
||||||
def self.update_report_all_formulae?(); end
|
def self.update_report_all_formulae?(); end
|
||||||
|
|
||||||
def self.update_to_tag?(); end
|
def self.update_to_tag?(); end
|
||||||
|
@ -2184,6 +2184,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
|
|||||||
|
|
||||||
*Default:* macOS: `/private/tmp`, Linux: `/tmp`.
|
*Default:* macOS: `/private/tmp`, Linux: `/tmp`.
|
||||||
|
|
||||||
|
- `HOMEBREW_UNINSTALL_AUTOREMOVE`
|
||||||
|
<br>If set, `brew autoremove` is run after every successful call to `brew uninstall`.
|
||||||
|
|
||||||
- `HOMEBREW_UPDATE_REPORT_ALL_FORMULAE`
|
- `HOMEBREW_UPDATE_REPORT_ALL_FORMULAE`
|
||||||
<br>If set, `brew update` lists changes to all formulae and cask files rather than only showing when they are new and not installed or outdated and installed.
|
<br>If set, `brew update` lists changes to all formulae and cask files rather than only showing when they are new and not installed or outdated and installed.
|
||||||
|
|
||||||
|
@ -3207,6 +3207,12 @@ 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_UNINSTALL_AUTOREMOVE\fR
|
||||||
|
.
|
||||||
|
.br
|
||||||
|
If set, \fBbrew autoremove\fR is run after every successful call to \fBbrew uninstall\fR\.
|
||||||
|
.
|
||||||
|
.TP
|
||||||
\fBHOMEBREW_UPDATE_REPORT_ALL_FORMULAE\fR
|
\fBHOMEBREW_UPDATE_REPORT_ALL_FORMULAE\fR
|
||||||
.
|
.
|
||||||
.br
|
.br
|
||||||
|
Loading…
x
Reference in New Issue
Block a user