Sha256: b5bc137c41e8347e72d7b95d708992bf5e08f897ef6a46bc265be34fc03ea999

Contents?: true

Size: 728 Bytes

Versions: 4

Compression:

Stored size: 728 Bytes

Contents

module Brightbox
  desc 'Lists the api clients defined in the config'
  command [:client_list] do |c|

    c.action do |global_options, options, args|

      info "Using config file #{CONFIG.config_filename}"

      clients = CONFIG.clients.collect do |cid|
        c = CONFIG[cid]
        calias = c['alias']
        calias = calias + "*" if CONFIG.client_name == cid and CONFIG.clients.size > 1
        {
          :alias => calias,
          :client_id => c["client_id"],
          :secret => c["secret"],
          :api_url => c["api_url"],
          :auth_url => c["auth_url"] || c["api_url"]
        }
      end

      render_table clients, :fields => [:alias, :client_id, :secret, :api_url, :auth_url]
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-0.14.1 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.14.0 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.13.1 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.13.0 lib/brightbox-cli/commands/config-client-list.rb