brew/Library/Homebrew/cmd/options.rb

35 lines
738 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.options.empty?
2011-03-10 21:32:10 -08:00
if ARGV.include? '--compact'
puts f.options.collect {|o| o[0]} * " "
else
puts f.name
f.options.each do |o|
puts o[0]
puts "\t"+o[1]
end
puts
end
end
end
end