Sha256: 2811c076e64d48c647c87a87737a0200ece65421a0c8d6c7a9a1f73b84d76b58
Contents?: true
Size: 1.19 KB
Versions: 3
Compression:
Stored size: 1.19 KB
Contents
# frozen_string_literal: true require "thor" require_relative "../session" require_relative "./constants" module NeetoDeploy class CLI module Addon class Info < CLI::Base include Constants include Session attr_reader :addon_name def initialize(options) super() @addon_name = options[:addon] end def run ui.execute_with_loading("Fetching info...") do send_request end print_output end private def flatten_hash_from(hash) hash.each_with_object({}) do |(key, value), memo| next flatten_hash_from(value).each do |k, v| memo["#{k}".intern] = v end if value.is_a? Hash memo[key] = value end end def send_request @response = send_get_request(addon_url(addon_name), {}) end def print_output ui.error(@response["error"]) and return unless @response.success? flatten_hash_from(JSON[@response.body]).each do |k, v| ui.info("#{k}: #{v}") end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neetodeploy-1.1.13 | lib/neeto_deploy/cli/addon/info.rb |
neetodeploy-1.1.12 | lib/neeto_deploy/cli/addon/info.rb |
neetodeploy-1.1.11 | lib/neeto_deploy/cli/addon/info.rb |