Clean up brew options

This commit is contained in:
Jack Nagel 2013-06-26 15:08:45 -05:00
parent 872cf44bbc
commit ce4b621874

View File

@ -1,29 +1,24 @@
require 'formula' require 'formula'
require 'cmd/outdated'
def ff
if ARGV.include? "--all"
Formula.to_a
elsif ARGV.include? "--installed"
# outdated brews count as installed
outdated = Homebrew.outdated_brews.collect{ |b| b.name }
Formula.select do |f|
f.installed? or outdated.include? f.name
end
else
raise FormulaUnspecifiedError if ARGV.named.empty?
ARGV.formulae
end
end
module Homebrew extend self module Homebrew extend self
def options def options
ff.each do |f| 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? next if f.build.empty?
if ARGV.include? '--compact' if ARGV.include? '--compact'
puts f.build.as_flags.sort * " " puts f.build.as_flags.sort * " "
else else
puts f.name if ff.length > 1 puts f.name if formulae.length > 1
dump_options_for_formula f dump_options_for_formula f
puts puts
end end