Sha256: fd078a749a8365199b913e652e1d109d47d809b4b58099649d323e6fc80646a7

Contents?: true

Size: 535 Bytes

Versions: 3

Compression:

Stored size: 535 Bytes

Contents

module Brightbox
  
  command [:accounts] do |cmd|

    cmd.desc "Set a default account"
    cmd.arg_name "account-id"
    cmd.command [:default] do |c|

      c.action do |global_options, options, args|

        if args.empty?
          raise "You must specify the account-id to set as default."
        end
        account_id = args.shift
        account = Account.find(account_id)

        unless account
          raise "Invalid account-id"
        end

        $config.save_default_account(account_id)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/accounts-default.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/accounts-default.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/accounts-default.rb