Sha256: 630e48c77c84a9af23ad91cbb6aa6db365c51d1a54e7b0ac5849b8313480340c

Contents?: true

Size: 1.15 KB

Versions: 17

Compression:

Stored size: 1.15 KB

Contents

module Brightbox
  desc "Lists the type of templates available for servers"
  command [:types] do |cmd|
    cmd.default_command :list

    cmd.desc "List types"
    cmd.arg_name "[type-id...]"
    cmd.command [:list] do |c|
      c.action do |global_options, _options, args|
        types = if args.empty?
                  Type.find :all
                else
                  Type.find_or_call(args) do |id|
                    warn "Couldn't find type #{id}"
                  end
                end

        render_table(types.sort, global_options)
      end
    end

    cmd.desc "Show detailed type info"
    cmd.arg_name "type-id..."
    cmd.command [:show] do |c|
      c.action do |global_options, _options, args|
        if args.empty?
          raise "You must specify the types you want to show"
        end

        types = Type.find_or_call(args) do |id|
          warn "Couldn't find type #{id}"
        end

        display_options = {
          :vertical => true,
          :fields => %i[id handle status name ram disk cores]
        }

        table_opts = global_options.merge(display_options)
        render_table(types, table_opts)
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
brightbox-cli-5.0.0.rc2 lib/brightbox-cli/commands/types.rb
brightbox-cli-5.0.0.rc1 lib/brightbox-cli/commands/types.rb
brightbox-cli-5.0.0.alpha lib/brightbox-cli/commands/types.rb
brightbox-cli-4.8.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.7.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.6.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.5.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.5.0.rc1 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.4.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.3.2 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.3.1 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.3.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.2.1 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.2.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.1.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.0.0 lib/brightbox-cli/commands/types.rb
brightbox-cli-4.0.0.rc2 lib/brightbox-cli/commands/types.rb