Sha256: 9b3644ed2e25f10fd58d5ee544330a1fc4a3acbc13ec8e24afb9e7d6d37c1fa9
Contents?: true
Size: 1.08 KB
Versions: 4
Compression:
Stored size: 1.08 KB
Contents
require "cli-format" class Jets::CLI class Url < Base rescue_api_error def run if @options[:format] == "json" puts data.to_json # simpler json format allows for: jets url | jq else present(data) end end private def present(items) presenter = CliFormat::Presenter.new(@options) presenter.empty_message = "No url info found" presenter.header = ["Name", "Value"] if @options[:header] # default: false data.keys.sort.each do |name| next if name.to_s == "queue_url" # dont show Queue Url name_url = name.to_s.titleize value = data[name] row = [name_url, value] presenter.rows << row end presenter.show end def data release = Release::Info.new(@options).get data = release.endpoints.inject({}) do |acc, endpoint| acc.merge!(endpoint[:name] => endpoint[:url]) end data.delete_if { |k, v| v.nil? } # remove nil values data.delete_if { |k| k.include?("queue_url") } unless @options[:all] data end memoize :data end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
jets-6.0.5 | lib/jets/cli/url.rb |
jets-6.0.4 | lib/jets/cli/url.rb |
jets-6.0.3 | lib/jets/cli/url.rb |
jets-6.0.2 | lib/jets/cli/url.rb |