Sha256: 4b2439440fb41d5f7412d167213b94cc8baefcfe8cfc67a68cc337a12296128a

Contents?: true

Size: 817 Bytes

Versions: 28

Compression:

Stored size: 817 Bytes

Contents

module Brightbox
  command [:config] do |cmd|

    cmd.desc "Remove api client details from config"
    cmd.arg_name "alias"
    cmd.command [:client_remove] do |c|

      c.action do |_global_options, _options, args|

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

        calias = args.shift

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

        client_config = Brightbox.config.section_names.find do |config|
          Brightbox.config[config]["alias"] == calias
        end

        if client_config.nil?
          raise "An api client with the alias #{calias} does not exist in the config"
        end

        info "Removing api client #{calias}"
        Brightbox.config.delete_section client_config
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
brightbox-cli-3.3.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-3.2.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-3.1.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-3.0.1 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-3.0.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.12.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.11.2 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.11.1 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.11.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.10.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.9.3 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.9.2 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.9.1 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.9.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.8.2 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.8.1 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.8.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.7.1 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.7.0 lib/brightbox-cli/commands/config/client-remove.rb
brightbox-cli-2.6.0 lib/brightbox-cli/commands/config/client-remove.rb