Sha256: c13fc82bba2b90e7a86e8146fec348711062875ce965e3f069695ca5c13238d1

Contents?: true

Size: 769 Bytes

Versions: 16

Compression:

Stored size: 769 Bytes

Contents

require "vmc/cli/app/base"

module VMC::App
  class Rename < Base
    desc "Rename an application"
    group :apps, :manage
    input :app, :desc => "Application to rename", :argument => :optional,
          :from_given => by_name(:app)
    input :name, :desc => "New application name", :argument => :optional
    def rename
      app = input[:app]
      name = input[:name]

      app.name = name

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

    private

    def ask_app
      apps = client.apps
      fail "No applications." if apps.empty?

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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cloulu-1.0.0 lib/vmc/cli/app/rename.rb
cloulu-0.7.0 lib/vmc/cli/app/rename.rb
cloulu-0.6.6 lib/vmc/cli/app/rename.rb
cloulu-0.6.5 lib/vmc/cli/app/rename.rb
cloulu-0.6.1 lib/vmc/cli/app/rename.rb
cloulu-0.6.0 lib/vmc/cli/app/rename.rb
cloulu-0.5.1 lib/vmc/cli/app/rename.rb
cloulu-0.5.0 lib/vmc/cli/app/rename.rb
cloulu-0.3.0 lib/vmc/cli/app/rename.rb
cloulu-0.2.6 lib/vmc/cli/app/rename.rb
cloulu-0.2.5 lib/vmc/cli/app/rename.rb
cloulu-0.2.4 lib/vmc/cli/app/rename.rb
cloulu-0.2.3 lib/vmc/cli/app/rename.rb
cloulu-0.2.1 lib/vmc/cli/app/rename.rb
cloulu-0.2.0 lib/vmc/cli/app/rename.rb
cloulu-0.1.5 lib/vmc/cli/app/rename.rb