brew-switch: simplify implementation
This commit is contained in:
parent
6fa64da7f3
commit
cd35fc3bbd
@ -21,14 +21,14 @@ end
|
|||||||
unless (cellar+version).directory?
|
unless (cellar+version).directory?
|
||||||
onoe "#{name} does not have a version \"#{version}\" in the Cellar."
|
onoe "#{name} does not have a version \"#{version}\" in the Cellar."
|
||||||
|
|
||||||
versions = cellar.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s }
|
versions = cellar.subdirs.map { |d| Keg.new(d).version }
|
||||||
puts "Versions available: #{versions.join(', ')}"
|
puts "Versions available: #{versions.join(', ')}"
|
||||||
|
|
||||||
exit 3
|
exit 3
|
||||||
end
|
end
|
||||||
|
|
||||||
# Unlink all existing versions
|
# Unlink all existing versions
|
||||||
cellar.children.select { |pn| pn.directory? }.each do |v|
|
cellar.subdirs.each do |v|
|
||||||
keg = Keg.new(v)
|
keg = Keg.new(v)
|
||||||
puts "Cleaning #{keg}"
|
puts "Cleaning #{keg}"
|
||||||
keg.unlink
|
keg.unlink
|
||||||
|
Loading…
x
Reference in New Issue
Block a user