tap: improve arguments resolution

* Use `ARGV.include?` instead of `ARGV.first ==`, so users can pass
  `-v`/`-d` before the function flags(i.e. `--list-pinned` etc)
* Restore the ability to call `brew tap --flags tap/name`.
This commit is contained in:
Xu Cheng 2015-12-26 13:01:52 +08:00
parent 68361be36c
commit c318a9a03e

View File

@ -3,18 +3,18 @@ require "core_formula_repository"
module Homebrew
def tap
if ARGV.empty?
puts Tap.names
elsif ARGV.first == "--repair"
if ARGV.include? "--repair"
Tap.each(&:link_manpages)
migrate_taps :force => true
elsif ARGV.first == "--list-official"
elsif ARGV.include? "--list-official"
require "official_taps"
puts OFFICIAL_TAPS.map { |t| "homebrew/#{t}" }
elsif ARGV.first == "--list-pinned"
elsif ARGV.include? "--list-pinned"
puts Tap.select(&:pinned?).map(&:name)
elsif ARGV.named.empty?
puts Tap.names
else
tap = Tap.fetch(ARGV[0])
tap = Tap.fetch(ARGV.named[0])
begin
tap.install(:clone_target => ARGV.named[1],
:full_clone => ARGV.include?("--full"))