brew unlink command

Closes Homebrew/homebrew#8
This commit is contained in:
Max Howell 2009-08-29 21:07:26 +01:00
parent f7d8003f3b
commit 65cb8ea09f
2 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,19 @@ class Keg <Pathname
parent.rmdir_if_possible parent.rmdir_if_possible
end end
def unlink
n=0
Pathname.new(self).find do |src|
next if src == self
dst=HOMEBREW_PREFIX+src.relative_path_from(self)
next unless dst.symlink?
dst.unlink
n+=1
Find.prune if src.directory?
end
n
end
def link def link
$n=0 $n=0
$d=0 $d=0

View File

@ -114,6 +114,9 @@ begin
when 'unlink' when 'unlink'
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"} ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
when 'unlink'
ARGV.kegs.each {|keg| puts "#{keg.unlink} links removed for #{keg}"}
when 'rm', 'uninstall', 'remove' when 'rm', 'uninstall', 'remove'
ARGV.kegs.each do |keg| ARGV.kegs.each do |keg|
puts "Uninstalling #{keg}..." puts "Uninstalling #{keg}..."