blob: 641f9dce187e688ef6c0fd188b4e87d8bf5cec41 (
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
30
31
32
33
34
|
require 'formula'
module Homebrew extend self
def options
if ARGV.include? '--all'
puts_options Formula.to_a
elsif ARGV.include? '--installed'
puts_options Formula.installed
else
raise FormulaUnspecifiedError if ARGV.named.empty?
puts_options ARGV.formulae
end
end
def puts_options(formulae)
formulae.each do |f|
next if f.build.empty?
if ARGV.include? '--compact'
puts f.build.as_flags.sort * " "
else
puts f.name if formulae.length > 1
dump_options_for_formula f
puts
end
end
end
def dump_options_for_formula f
f.build.sort_by(&:flag).each do |opt|
puts opt.flag
puts "\t"+opt.description
end
end
end
|