cmd/info: fix --json argument handling.

`--all` and `--installed` do not require formulae arguments.

Fixes https://github.com/Homebrew/brew/issues/6842
This commit is contained in:
Mike McQuaid 2019-12-16 11:23:55 +00:00
parent d556d02cd4
commit 4f732a0170
No known key found for this signature in database
GPG Key ID: 48A898132FD8EE70

View File

@ -78,7 +78,9 @@ module Homebrew
if args.json
raise UsageError, "Invalid JSON version: #{args.json}" unless ["v1", true].include? args.json
raise UsageError, "This command's option requires a formula argument" if ARGV.named.empty?
if !(args.all? || args.installed?) && ARGV.named.blank?
raise UsageError, "This command's option requires a formula argument"
end
print_json
elsif args.github?