Sha256: fc05d41f7aeba70c8b7f1e75ebc400736d84580e76abef2eb5b376a40109d56c

Contents?: true

Size: 908 Bytes

Versions: 4

Compression:

Stored size: 908 Bytes

Contents

module Brightbox
  command [:images] do |cmd|

    cmd.default_command :list

    cmd.desc "List available images"
    cmd.arg_name "[image-id...]"
    cmd.command [:list] do |c|

      c.desc "Show all public images from all accounts"
      c.switch [:a, "show-all"], :negatable => false

      c.desc "Show only images of a given type"
      c.flag [:t, :type]

      c.desc "Show only images of a given status"
      c.flag [:s, :status]

      c.desc "Show only images for a given account identifier"
      c.flag [:l, :account]

      c.action do |global_options, options, args|

        if args.empty?
          images = Image.find(:all)
        else
          images = Image.find_or_call(args) do |id|
            warn "Couldn't find image #{id}"
          end
        end

        images = Image.filter_images(images, options)
        render_table(images, global_options)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
brightbox-cli-1.1.0 lib/brightbox-cli/commands/images-list.rb
brightbox-cli-1.0.0 lib/brightbox-cli/commands/images-list.rb
brightbox-cli-1.0.0.rc2 lib/brightbox-cli/commands/images-list.rb
brightbox-cli-1.0.0.rc1 lib/brightbox-cli/commands/images-list.rb