brew/Library/Homebrew/cmd/options.rb

40 lines
809 B
Ruby
Raw Normal View History

2011-03-19 09:58:42 -07:00
require 'formula'
require 'cmd/outdated'
2011-03-19 09:58:42 -07:00
def ff
if ARGV.include? "--all"
Formula.all
elsif ARGV.include? "--installed"
# outdated brews count as installed
outdated = Homebrew.outdated_brews.collect{ |b| b.name }
Formula.all.select do |f|
f.installed? or outdated.include? f.name
end
2011-03-19 09:58:42 -07:00
else
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|
next if f.build.empty?
2011-03-10 21:32:10 -08:00
if ARGV.include? '--compact'
puts f.build.collect {|k,v| k} * " "
2011-03-10 21:32:10 -08:00
else
puts f.name if ff.length > 1
dump_options_for_formula f
2011-03-10 21:32:10 -08:00
puts
end
end
end
def dump_options_for_formula f
2012-08-09 09:24:07 -07:00
f.build.each do |k,v|
puts "--"+k
puts "\t"+v
end
end
end