module GoodData::GoodotCLI
Public Class Methods
create_api_error_message(e)
click to toggle source
# File lib/goodot/cli/shared.rb, line 68 def self.create_api_error_message(e) HighLine.color(GoodData::Helpers.interpolate_error_message(MultiJson.load(e.http_body)), :red) end
launch(args)
click to toggle source
# File lib/goodot/cli/app.rb, line 19 def self.launch(args) exit run args end
table_with_headers(data, methods, options = {})
click to toggle source
# File lib/goodot/cli/shared.rb, line 72 def self.table_with_headers(data, methods, options = {}) limit = options[:limit] || data.size headers = options[:headers] Terminal::Table.new do |t| t << if headers headers else methods.map(&:to_s).map(&:capitalize) end t << :separator data.take(limit).each do |p| res = if p.is_a?(Hash) methods.map { |m| m.is_a?(Proc) ? m.call(p) : p[m] } else methods.map { |m| m.is_a?(Proc) ? m.call(p) : p.send(m) } end t.add_row(res) end end end