Sha256: 6057425e0a52922b6dab999eb2b21fa23a1975e4b0f05e5f3881484c36617808

Contents?: true

Size: 880 Bytes

Versions: 18

Compression:

Stored size: 880 Bytes

Contents

module Brightbox
  command [:groups] do |cmd|
    cmd.desc I18n.t("groups.update.desc")
    cmd.arg_name "grp-id"
    cmd.command [:update] do |c|
      c.desc I18n.t("options.name.desc")
      c.flag %i[n name]

      c.desc I18n.t("options.description.desc")
      c.flag %i[d description]

      c.action do |global_options, options, args|
        grp_id = args.shift
        raise "You must specify the server group to update as the first argument" unless grp_id =~ /^grp-/

        params = NilableHash.new

        if options[:n]
          params[:name] = options[:n]
        end

        if options[:d]
          params[:description] = options[:d]
        end

        params.nilify_blanks

        sg = ServerGroup.find grp_id
        info "Updating server group #{sg}"
        sg = sg.update(params)
        render_table([sg], global_options)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

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