aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/options.rb
blob: 454a2c7ce7b514d12c1413d289cc4911b15271d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
require 'formula'

def ff
  if ARGV.include? "--all"
    Formula.all
  elsif ARGV.include? "--installed"
    Formula.all.reject{ |f| not f.installed? }
  else
    ARGV.formulae
  end
end

module Homebrew extend self
  def options
    ff.each do |f|
      next if f.options.empty?
      if ARGV.include? '--compact'
        puts f.options.collect {|o| o[0]} * " "
      else
        puts f.name
        f.options.each do |o|
          puts o[0]
          puts "\t"+o[1]
        end
        puts
      end
    end
  end
end