brew.h info takes a formula parameter rather than a string

* Preference is for commands to take instantiated formulae as parameters
  rather than formula names, so alias resolution can be centralized.
This commit is contained in:
Max Howell 2010-03-09 02:13:33 +00:00 committed by Adam Vandenberg
parent a496ca0166
commit bc5ee7c482
2 changed files with 3 additions and 6 deletions

View File

@ -185,12 +185,9 @@ def github_info name
return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}" return "http://github.com/#{user}/homebrew/commits/#{branch}/Library/Formula/#{formula_name}"
end end
def info name def info f
require 'formula'
exec 'open', github_info(name) if ARGV.flag? '--github' exec 'open', github_info(name) if ARGV.flag? '--github'
f=Formula.factory name
puts "#{f.name} #{f.version}" puts "#{f.name} #{f.version}"
puts f.homepage puts f.homepage
@ -213,7 +210,7 @@ def info name
puts puts
end end
history = github_info(name) history = github_info(f.name)
puts history if history puts history if history
rescue FormulaUnavailableError rescue FormulaUnavailableError

View File

@ -243,7 +243,7 @@ begin
elsif ARGV[0][0..6] == 'http://' elsif ARGV[0][0..6] == 'http://'
puts Pathname.new(ARGV.shift).version puts Pathname.new(ARGV.shift).version
else else
ARGV.named.each {|name| info name} ARGV.formulae.each{ |f| info f }
end end
when 'cleanup' when 'cleanup'