aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAdam Vandenberg2010-04-30 10:16:39 -0700
committerAdam Vandenberg2010-04-30 10:16:39 -0700
commit083e2a4b45d3f88bd5960da6caba07693e94fee4 (patch)
treeccbc11d8b5b5ee824431cd077a713ca89595845c /bin
parent77c02d3e865d9b688230e75acbca2d9afc2a3a5b (diff)
downloadhomebrew-083e2a4b45d3f88bd5960da6caba07693e94fee4.tar.bz2
`brew list --versions [formulae]`
Add a `--versions` switch to `brew list` that shows all versions found in the cellar for the selected formulae.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/brew b/bin/brew
index 9061d4957..abdfd43df 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<<HOMEBREW_CELLAR if HOMEBREW_CELLAR.exist?