Add remove --force

This commit is contained in:
Adam Vandenberg 2010-10-17 17:52:10 -07:00
parent cdf35d1d8d
commit 266b3265aa
3 changed files with 31 additions and 10 deletions

View File

@ -99,9 +99,12 @@ didn't include with OS X.
* `home` <formula>: * `home` <formula>:
Opens a browser to <formula>'s homepage. Opens a browser to <formula>'s homepage.
* `rm`, `remove` <formula>: * `rm`, `remove [--force]` <formula>:
Uninstalls <formula>. Uninstalls <formula>.
If `--force` is passed, and there are multiple versions of <formula>
installed, deletes all installed versions.
* `create [--cache]` <URL>: * `create [--cache]` <URL>:
Generates a formula for the downloadable file at <URL> and opens it in Generates a formula for the downloadable file at <URL> and opens it in
$EDITOR. Homebrew will attempt to automatically derive the formula name $EDITOR. Homebrew will attempt to automatically derive the formula name

View File

@ -188,6 +188,20 @@ begin
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"} ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
when 'rm', 'uninstall', 'remove' when 'rm', 'uninstall', 'remove'
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 begin
ARGV.kegs.each do |keg| ARGV.kegs.each do |keg|
puts "Uninstalling #{keg}..." puts "Uninstalling #{keg}..."
@ -198,6 +212,7 @@ begin
onoe e onoe e
puts "Use `brew remove --force #{e.name}` to remove all versions." puts "Use `brew remove --force #{e.name}` to remove all versions."
end end
end
when 'prune' when 'prune'
prune prune

View File

@ -105,9 +105,12 @@ Opens a browser to Homebrew\'s own homepage\.
Opens a browser to \fIformula\fR\'s homepage\. Opens a browser to \fIformula\fR\'s homepage\.
. .
.TP .TP
\fBrm\fR, \fBremove\fR \fIformula\fR \fBrm\fR, \fBremove [\-\-force]\fR \fIformula\fR
Uninstalls \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 .TP
\fBcreate [\-\-cache]\fR \fIURL\fR \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\. 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\.