From 083e2a4b45d3f88bd5960da6caba07693e94fee4 Mon Sep 17 00:00:00 2001 From: Adam Vandenberg Date: Fri, 30 Apr 2010 10:16:39 -0700 Subject: [PATCH] `brew list --versions [formulae]` Add a `--versions` switch to `brew list` that shows all versions found in the cellar for the selected formulae. --- bin/brew | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bin/brew b/bin/brew index 9061d495727f..abdfd43dfafd 100755 --- a/bin/brew +++ b/bin/brew @@ -114,6 +114,16 @@ begin dirs -= ['Library', 'Cellar', '.git'] Dir.chdir HOMEBREW_PREFIX exec 'find', *dirs + %w[-type f ( ! -iname .ds_store ! -iname brew )] + elsif ARGV.flag? '--versions' + if ARGV.named.empty? + to_list = HOMEBREW_CELLAR.children.select { |pn| pn.directory? } + else + to_list = ARGV.named.collect { |n| HOMEBREW_CELLAR+n }.select { |pn| pn.exist? } + end + to_list.each do |d| + versions = d.children.select { |pn| pn.directory? }.collect { |pn| pn.basename.to_s } + puts "#{d.basename} #{versions *' '}" + end elsif ARGV.named.empty? ENV['CLICOLOR']=nil exec 'ls', *ARGV.options<