Sha256: b11eb84d20b8f3d53170be168ad8730c30daf545e01b183fa12979c8a76ab006

Contents?: true

Size: 963 Bytes

Versions: 36

Compression:

Stored size: 963 Bytes

Contents

require "cf/cli/space/base"

module CF::Space
  class Rename < Base
    desc "Rename a space"
    group :spaces
    input :organization, :desc => "Space's organization",
          :aliases => ["--org", "-o"], :from_given => by_name(:organization),
          :default => proc { client.current_organization }
    input :space, :desc => "Space to rename", :argument => :optional,
          :from_given => by_name(:space)
    input :name, :desc => "New space name", :argument => :optional
    def rename_space
      space = input[:space, org]
      name = input[:name]

      space.name = name

      with_progress("Renaming to #{c(name, :name)}") do
        space.update!
      end
    end

    private

    def ask_space(org)
      spaces = org.spaces
      fail "No spaces." if spaces.empty?

      ask("Rename which space?", :choices => spaces.sort_by(&:name),
          :display => proc(&:name))
    end

    def ask_name
      ask("New name")
    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
cf-5.4.7 lib/cf/cli/space/rename.rb
cf-5.4.7.rc1 lib/cf/cli/space/rename.rb
cf-5.4.5 lib/cf/cli/space/rename.rb
cf-5.4.4 lib/cf/cli/space/rename.rb
trucker-cli-0.0.3 lib/cf/cli/space/rename.rb
cf-5.4.3 lib/cf/cli/space/rename.rb
cf-5.4.2 lib/cf/cli/space/rename.rb
trucker-cli-0.0.2 lib/cf/cli/space/rename.rb
trucker-cli-0.0.1 lib/cf/cli/space/rename.rb
cf-5.4.1 lib/cf/cli/space/rename.rb
cf-5.4.1.rc1 lib/cf/cli/space/rename.rb
cf-5.4.0 lib/cf/cli/space/rename.rb
cf-5.3.1 lib/cf/cli/space/rename.rb
cf-5.3.0 lib/cf/cli/space/rename.rb
cf-5.2.2 lib/cf/cli/space/rename.rb
cf-5.2.1.rc15 lib/cf/cli/space/rename.rb
cf-5.2.1.rc14 lib/cf/cli/space/rename.rb
cf-5.2.1.rc13 lib/cf/cli/space/rename.rb
cf-5.2.1.rc12 lib/cf/cli/space/rename.rb
cf-5.2.1.rc11 lib/cf/cli/space/rename.rb