From cd35fc3bbd4a51264da5cd6fcb97b1bc6bdadcd1 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 19 May 2013 20:25:11 -0500 Subject: [PATCH] brew-switch: simplify implementation --- Library/Contributions/cmd/brew-switch.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/Contributions/cmd/brew-switch.rb b/Library/Contributions/cmd/brew-switch.rb index 6f61201891..5cfe86d63d 100755 --- a/Library/Contributions/cmd/brew-switch.rb +++ b/Library/Contributions/cmd/brew-switch.rb @@ -21,14 +21,14 @@ end unless (cellar+version).directory? 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(', ')}" exit 3 end # Unlink all existing versions -cellar.children.select { |pn| pn.directory? }.each do |v| +cellar.subdirs.each do |v| keg = Keg.new(v) puts "Cleaning #{keg}" keg.unlink