Sha256: 68c145cb3412278bfe3253db65bc84a79e354ec9bf3d3fe12a90b9a20c8eee38

Contents?: true

Size: 712 Bytes

Versions: 14

Compression:

Stored size: 712 Bytes

Contents

module Brightbox
  desc 'Set the default api client in the config'
  arg_name 'alias'
  command [:client_default] do |c|

    c.action do |global_options, options, args|

      info "Using config file #{CONFIG.config_filename}"
      calias = args.shift

      if calias.nil?
        raise "You must specify the api alias you want to set as the default"
      end

      client_config = CONFIG.clients.detect{|c| CONFIG[c]['alias'] == calias}
      if client_config.nil?
        raise "An api client with the alias #{calias} does not exist in the config"
      end

      info "Setting #{calias} as default api client"
      CONFIG['core']['default_client'] = client_config
      CONFIG.save!

    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
brightbox-cli-0.18.1 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.18.0 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.5 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.4 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.3 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.2 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.1 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.17.0 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.16.0 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.15.0 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.14.1 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.14.0 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.13.1 lib/brightbox-cli/commands/config-client-default.rb
brightbox-cli-0.13.0 lib/brightbox-cli/commands/config-client-default.rb