2011-03-19 09:58:42 -07:00
|
|
|
require 'formula'
|
2011-11-22 19:28:05 -06:00
|
|
|
require 'cmd/outdated'
|
2011-03-19 09:58:42 -07:00
|
|
|
|
|
|
|
def ff
|
|
|
|
if ARGV.include? "--all"
|
2013-03-20 22:31:15 -05:00
|
|
|
Formula.to_a
|
2011-09-11 16:23:39 -05:00
|
|
|
elsif ARGV.include? "--installed"
|
2011-11-22 19:28:05 -06:00
|
|
|
# outdated brews count as installed
|
|
|
|
outdated = Homebrew.outdated_brews.collect{ |b| b.name }
|
2012-08-21 11:39:45 -04:00
|
|
|
Formula.select do |f|
|
2011-11-22 19:28:05 -06:00
|
|
|
f.installed? or outdated.include? f.name
|
|
|
|
end
|
2011-03-19 09:58:42 -07:00
|
|
|
else
|
2012-02-04 00:01:29 -06:00
|
|
|
raise FormulaUnspecifiedError if ARGV.named.empty?
|
2011-03-19 09:58:42 -07:00
|
|
|
ARGV.formulae
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-03-10 21:32:10 -08:00
|
|
|
module Homebrew extend self
|
|
|
|
def options
|
2011-03-19 09:58:42 -07:00
|
|
|
ff.each do |f|
|
2012-07-30 11:32:56 -07:00
|
|
|
next if f.build.empty?
|
2011-03-10 21:32:10 -08:00
|
|
|
if ARGV.include? '--compact'
|
2013-01-14 15:07:31 -06:00
|
|
|
puts f.build.as_flags.sort * " "
|
2011-03-10 21:32:10 -08:00
|
|
|
else
|
2012-08-04 15:40:36 -04:00
|
|
|
puts f.name if ff.length > 1
|
|
|
|
dump_options_for_formula f
|
2011-03-10 21:32:10 -08:00
|
|
|
puts
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2012-08-04 15:40:36 -04:00
|
|
|
|
|
|
|
def dump_options_for_formula f
|
2013-01-14 15:07:31 -06:00
|
|
|
f.build.sort_by(&:flag).each do |opt|
|
2012-08-13 23:47:05 -05:00
|
|
|
puts opt.flag
|
|
|
|
puts "\t"+opt.description
|
2012-08-04 15:40:36 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|