brew/Library/Homebrew/cmd/options.rb

39 lines
972 B
Ruby
Raw Normal View History

2016-04-08 16:28:43 +02:00
#: * `options` [`--compact`] (`--all`|`--installed`|<formulae>):
#: Display install options specific to <formulae>.
#:
#: If `--compact` is passed, show all options on a single line separated by
#: spaces.
#:
#: If `--all` is passed, show options for all formulae.
#:
#: If `--installed` is passed, show options for all installed formulae.
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