module Brightbox
Constants
- AMBIGUOUS_CLIENT_ERROR
- DEFAULT_API_ENDPOINT
- EMBEDDED_APP_ID
- EMBEDDED_APP_SECRET
- IDENTIFIER_SIZE
-
The length of the identifier string.
- NO_CLIENT_MESSAGE
- VERSION
Public Class Methods
Source
# File lib/brightbox/cli/config.rb, line 12 def self.config CLI::Config.instance.config end
Source
# File lib/brightbox/cli/config.rb, line 16 def self.config=(replacement) CLI::Config.instance.config = replacement end
Source
# File lib/brightbox-cli/commands/configmaps.rb, line 158 def parse_configmap_data_options(options) if options[:data] && options[:"data-file"] raise I18n.t("configmaps.options.multiple_data") end map_data = options[:data] data_filename = options[:"data-file"] if data_filename file_handler = lambda do |file| map_data = file.read end if data_filename == "-" file_handler[$stdin] else File.open(data_filename, "r", &file_handler) end raise map_data.inspect if map_data.nil? || map_data == "" end map_data end
Source
# File lib/brightbox-cli/tables.rb, line 72 def render_table(rows, options = {}) options = { :description => false }.merge options # Figure out the fields from the :model option if options[:model] && options[:fields].nil? options[:fields] = options[:model].default_field_order end # Figure out the fields from the first row if options[:fields].nil? && rows.first.class.respond_to?(:default_field_order) options[:fields] = rows.first.class.default_field_order end # Call to_row on all the rows rows = rows.map do |row| row.respond_to?(:to_row) ? row.to_row : row end # Call render_cell on all the cells rows.each do |row| # FIXME: default Api subclasses do not respond to #keys so specialising # #to_row is required to not break the following row.each_key do |k| row[k] = row[k].render_cell if row[k].respond_to? :render_cell end end if options[:s] # Simple output rows.each do |row| if options[:vertical] data options[:fields].map { |k| [k, row[k]].join("\t") }.join("\n") else data options[:fields].map { |k| row[k].is_a?(Array) ? row[k].join(",") : row[k] }.join("\t") end end elsif options[:vertical] # "graphical" table data ShowTable.render(rows, options) else data SimpleTable.render(rows, options) end end
Print nice ascii tables (or tab separated lists, depending on mode) Has lots of magic.
Private Instance Methods
Source
# File lib/brightbox-cli/commands/configmaps.rb, line 158 def parse_configmap_data_options(options) if options[:data] && options[:"data-file"] raise I18n.t("configmaps.options.multiple_data") end map_data = options[:data] data_filename = options[:"data-file"] if data_filename file_handler = lambda do |file| map_data = file.read end if data_filename == "-" file_handler[$stdin] else File.open(data_filename, "r", &file_handler) end raise map_data.inspect if map_data.nil? || map_data == "" end map_data end
Source
# File lib/brightbox-cli/tables.rb, line 72 def render_table(rows, options = {}) options = { :description => false }.merge options # Figure out the fields from the :model option if options[:model] && options[:fields].nil? options[:fields] = options[:model].default_field_order end # Figure out the fields from the first row if options[:fields].nil? && rows.first.class.respond_to?(:default_field_order) options[:fields] = rows.first.class.default_field_order end # Call to_row on all the rows rows = rows.map do |row| row.respond_to?(:to_row) ? row.to_row : row end # Call render_cell on all the cells rows.each do |row| # FIXME: default Api subclasses do not respond to #keys so specialising # #to_row is required to not break the following row.each_key do |k| row[k] = row[k].render_cell if row[k].respond_to? :render_cell end end if options[:s] # Simple output rows.each do |row| if options[:vertical] data options[:fields].map { |k| [k, row[k]].join("\t") }.join("\n") else data options[:fields].map { |k| row[k].is_a?(Array) ? row[k].join(",") : row[k] }.join("\t") end end elsif options[:vertical] # "graphical" table data ShowTable.render(rows, options) else data SimpleTable.render(rows, options) end end
Print nice ascii tables (or tab separated lists, depending on mode) Has lots of magic.