Add version number to cask JSON option

`$ brew cask info --json=v1 <formula>` instead of `$ brew cask info --json <formula>`
This commit is contained in:
alexbostock 2018-07-04 15:03:31 +01:00
parent b548dbde97
commit 7e5addfb22

View File

@ -3,7 +3,7 @@ require "json"
module Hbc
class CLI
class Info < AbstractCommand
option "--json-v1", :json, false
option "--json=VERSION", :json
def initialize(*)
super
@ -11,9 +11,8 @@ module Hbc
end
def run
if json?
json = casks.map(&:to_hash)
puts JSON.generate(json)
if json == "v1"
puts JSON.generate(casks.map(&:to_hash))
else
casks.each do |cask|
odebug "Getting info for Cask #{cask}"