Sha256: 279cbf046f9d9b033453defd2d1ba66ca7037c40c647824cad6249d8acf8df65

Contents?: true

Size: 1015 Bytes

Versions: 35

Compression:

Stored size: 1015 Bytes

Contents

require "vmc/cli/space/base"

module VMC::Space
  class Rename < Base
    desc "Rename a space"
    group :spaces, :hidden => true
    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
      org = input[:organization]
      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

35 entries across 35 versions & 3 rubygems

Version Path
vmc-0.5.1 lib/vmc/cli/space/rename.rb
static-1.0.3 vendor/vmc-0.5.0/lib/vmc/cli/space/rename.rb
af-0.5.0.beta.11 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.10 lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc6 lib/vmc/cli/space/rename.rb
static-1.0.1 vendor/vmc-0.5.0/lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc5 lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc4 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.9 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.8 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.7 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.6 lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc3 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.5 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.4 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.3 lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc2 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.2 lib/vmc/cli/space/rename.rb
af-0.5.0.beta.1 lib/vmc/cli/space/rename.rb
vmc-0.5.1.rc1 lib/vmc/cli/space/rename.rb