Sha256: 2841ed5e449833b245d319134eed352c34f278d63741cd833d8afe356aa81597

Contents?: true

Size: 757 Bytes

Versions: 8

Compression:

Stored size: 757 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'] || cid
        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, global_options.merge(:fields => [:alias, :client_id, :secret, :api_url, :auth_url])
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.18.0 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.5 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.4 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.3 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.2 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.1 lib/brightbox-cli/commands/config-client-list.rb
brightbox-cli-0.17.0 lib/brightbox-cli/commands/config-client-list.rb