From ce4b6218740bea2d9175ab268ef0ccadcb455741 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 26 Jun 2013 15:08:45 -0500 Subject: [PATCH] Clean up `brew options` --- Library/Homebrew/cmd/options.rb | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/Library/Homebrew/cmd/options.rb b/Library/Homebrew/cmd/options.rb index 61b876e2f8..641f9dce18 100644 --- a/Library/Homebrew/cmd/options.rb +++ b/Library/Homebrew/cmd/options.rb @@ -1,29 +1,24 @@ 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 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? if ARGV.include? '--compact' puts f.build.as_flags.sort * " " else - puts f.name if ff.length > 1 + puts f.name if formulae.length > 1 dump_options_for_formula f puts end