brew/Library/Homebrew/cmd/options.rb

29 lines
615 B
Ruby
Raw Normal View History

require "formula"
require "options"
2011-03-19 09:58:42 -07:00
module Homebrew
2013-06-26 15:08:45 -05:00
def options
if ARGV.include? "--all"
2013-06-26 15:08:45 -05:00
puts_options Formula.to_a
elsif ARGV.include? "--installed"
2013-06-26 15:08:45 -05:00
puts_options Formula.installed
else
raise FormulaUnspecifiedError if ARGV.named.empty?
puts_options ARGV.formulae
end
2011-03-19 09:58:42 -07:00
end
2013-06-26 15:08:45 -05:00
def puts_options(formulae)
formulae.each do |f|
next if f.options.empty?
if ARGV.include? "--compact"
puts f.options.as_flags.sort * " "
2011-03-10 21:32:10 -08:00
else
2015-05-27 21:08:24 +08:00
puts f.full_name if formulae.length > 1
dump_options_for_formula f
2011-03-10 21:32:10 -08:00
puts
end
end
end
end