aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorRakesh2015-10-06 23:14:12 +0530
committerXu Cheng2015-10-07 14:05:11 +0800
commit2d60187e1a7e168e497fdcc1ba010c963081fc17 (patch)
treefd97e1f5960c7398e7b0d6cccae2309fe8011908 /Library
parentf629bb4e0f5fe03926642ef06107e0101f4c9bcc (diff)
downloadbrew-2d60187e1a7e168e497fdcc1ba010c963081fc17.tar.bz2
brew upgrade: provides an option `--cleanup`
Closes Homebrew/homebrew#44305. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/upgrade.rb6
-rw-r--r--Library/Homebrew/manpages/brew.1.md4
2 files changed, 8 insertions, 2 deletions
diff --git a/Library/Homebrew/cmd/upgrade.rb b/Library/Homebrew/cmd/upgrade.rb
index e1b7dd0dc..e9d46fa92 100644
--- a/Library/Homebrew/cmd/upgrade.rb
+++ b/Library/Homebrew/cmd/upgrade.rb
@@ -1,5 +1,6 @@
require "cmd/install"
require "cmd/outdated"
+require "cmd/cleanup"
module Homebrew
def upgrade
@@ -41,7 +42,10 @@ module Homebrew
puts pinned.map { |f| "#{f.full_name} #{f.pkg_version}" } * ", "
end
- outdated.each { |f| upgrade_formula(f) }
+ outdated.each do |f|
+ upgrade_formula(f)
+ cleanup_formula(f) if ARGV.include?("--cleanup") && f.installed?
+ end
end
def upgrade_pinned?
diff --git a/Library/Homebrew/manpages/brew.1.md b/Library/Homebrew/manpages/brew.1.md
index 06df14196..4009178db 100644
--- a/Library/Homebrew/manpages/brew.1.md
+++ b/Library/Homebrew/manpages/brew.1.md
@@ -476,11 +476,13 @@ Note that these flags should only appear after a command.
If `--rebase` is specified then `git pull --rebase` is used.
- * `upgrade [install-options]` [<formulae>]:
+ * `upgrade [install-options] [--cleanup]` [<formulae>]:
Upgrade outdated, unpinned brews.
Options for the `install` command are also valid here.
+ If `--cleanup` is specified then remove previously installed <formula> version(s).
+
If <formulae> are given, upgrade only the specified brews (but do so even
if they are pinned; see `pin`, `unpin`).