Sha256: c690efc2a510b63d01056c7bfb6f432c2a2b604def1b80aee5f83b2b4e283499

Contents?: true

Size: 705 Bytes

Versions: 9

Compression:

Stored size: 705 Bytes

Contents

module Brightbox
  command [:volumes] do |cmd|
    cmd.desc I18n.t("volumes.destroy.desc")
    cmd.arg_name I18n.t("volumes.args.many")

    cmd.command [:destroy] do |c|
      c.action do |_global_options, _options, args|
        raise I18n.t("volumes.args.specify_many_ids") if args.empty?

        volumes = Volume.find_or_call(args) do |id|
          raise I18n.t("volumes.args.unknown_id", volume: volume)
        end

        volumes.each do |volume|
          info I18n.t("volumes.destroy.acting", volume: volume)

          begin
            volume.destroy
          rescue Brightbox::Api::Conflict
            error "Could not destroy #{id}"
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
brightbox-cli-4.8.0 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.7.0 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.6.0 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.5.0 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.5.0.rc1 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.4.0 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.3.2 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.3.1 lib/brightbox-cli/commands/volumes/destroy.rb
brightbox-cli-4.3.0 lib/brightbox-cli/commands/volumes/destroy.rb