commit
86df821b92
@ -129,5 +129,32 @@ module Hbc
|
||||
odebug "Cask instance method '#{method}':", send(method).to_yaml
|
||||
end
|
||||
end
|
||||
|
||||
def to_h
|
||||
{
|
||||
"name" => name,
|
||||
"homepage" => homepage,
|
||||
"url" => url,
|
||||
"appcast" => appcast,
|
||||
"version" => version,
|
||||
"sha256" => sha256,
|
||||
"artifacts" => artifacts.map do |a|
|
||||
if a.respond_to? :to_h
|
||||
a.to_h
|
||||
elsif a.respond_to? :to_a
|
||||
a.to_a
|
||||
else
|
||||
a
|
||||
end
|
||||
end,
|
||||
"caveats" => caveats,
|
||||
"depends_on" => depends_on,
|
||||
"conflicts_with" => conflicts_with.to_a,
|
||||
"container" => container,
|
||||
"gpg" => gpg,
|
||||
"accessibility_access" => accessibility_access,
|
||||
"auto_updates" => auto_updates,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -1,17 +1,25 @@
|
||||
require "json"
|
||||
|
||||
module Hbc
|
||||
class CLI
|
||||
class Info < AbstractCommand
|
||||
option "--json=VERSION", :json
|
||||
|
||||
def initialize(*)
|
||||
super
|
||||
raise CaskUnspecifiedError if args.empty?
|
||||
end
|
||||
|
||||
def run
|
||||
if json == "v1"
|
||||
puts JSON.generate(casks.map(&:to_h))
|
||||
else
|
||||
casks.each do |cask|
|
||||
odebug "Getting info for Cask #{cask}"
|
||||
self.class.info(cask)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.help
|
||||
"displays information about the given Cask"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user