aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Vandenberg2010-10-17 17:52:10 -0700
committerAdam Vandenberg2010-10-17 17:52:10 -0700
commit3ca30d2d5b5664216446f9752d81129d4a758bdd (patch)
tree437c053e8aa334187f81254edf5515cc170f9af8
parent55152f0be4e03f465bbc7d4fb6c78de4d13369ef (diff)
downloadhomebrew-3ca30d2d5b5664216446f9752d81129d4a758bdd.tar.bz2
Add remove --force
-rw-r--r--Library/Contributions/manpages/brew.1.md5
-rwxr-xr-xbin/brew31
-rw-r--r--share/man/man1/brew.15
3 files changed, 31 insertions, 10 deletions
diff --git a/Library/Contributions/manpages/brew.1.md b/Library/Contributions/manpages/brew.1.md
index 815492652..8a327b737 100644
--- a/Library/Contributions/manpages/brew.1.md
+++ b/Library/Contributions/manpages/brew.1.md
@@ -99,9 +99,12 @@ didn't include with OS X.
* `home` <formula>:
Opens a browser to <formula>'s homepage.
- * `rm`, `remove` <formula>:
+ * `rm`, `remove [--force]` <formula>:
Uninstalls <formula>.
+ If `--force` is passed, and there are multiple versions of <formula>
+ installed, deletes all installed versions.
+
* `create [--cache]` <URL>:
Generates a formula for the downloadable file at <URL> and opens it in
$EDITOR. Homebrew will attempt to automatically derive the formula name
diff --git a/bin/brew b/bin/brew
index 3e2dbf9a7..7531d59ed 100755
--- a/bin/brew
+++ b/bin/brew
@@ -188,15 +188,30 @@ begin
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
when 'rm', 'uninstall', 'remove'
- begin
- ARGV.kegs.each do |keg|
- puts "Uninstalling #{keg}..."
- keg.unlink
- keg.uninstall
+ if ARGV.flag? "--force"
+ require 'formula'
+ ARGV.formulae.each do |f|
+ formula_cellar = f.prefix.parent
+ next unless File.exist? formula_cellar
+ puts "Uninstalling #{f.name}..."
+ formula_cellar.children do |k|
+ keg = Keg.new(k)
+ keg.unlink
+ end
+
+ formula_cellar.rmtree
+ end
+ else
+ begin
+ ARGV.kegs.each do |keg|
+ puts "Uninstalling #{keg}..."
+ keg.unlink
+ keg.uninstall
+ end
+ rescue MultipleVersionsInstalledError => e
+ onoe e
+ puts "Use `brew remove --force #{e.name}` to remove all versions."
end
- rescue MultipleVersionsInstalledError => e
- onoe e
- puts "Use `brew remove --force #{e.name}` to remove all versions."
end
when 'prune'
diff --git a/share/man/man1/brew.1 b/share/man/man1/brew.1
index 50a71328b..f03a623eb 100644
--- a/share/man/man1/brew.1
+++ b/share/man/man1/brew.1
@@ -105,9 +105,12 @@ Opens a browser to Homebrew\'s own homepage\.
Opens a browser to \fIformula\fR\'s homepage\.
.
.TP
-\fBrm\fR, \fBremove\fR \fIformula\fR
+\fBrm\fR, \fBremove [\-\-force]\fR \fIformula\fR
Uninstalls \fIformula\fR\.
.
+.IP
+If \fB\-\-force\fR is passed, and there are multiple versions of \fIformula\fR installed, deletes all installed versions\.
+.
.TP
\fBcreate [\-\-cache]\fR \fIURL\fR
Generates a formula for the downloadable file at \fIURL\fR and opens it in $EDITOR\. Homebrew will attempt to automatically derive the formula name and version, if it fails, you\'ll have to make your own template\. I suggest copying wget\'s\.