require "vmc/cli/route/base" module VMC::Route class Map < Base def precondition fail_on_v2 end desc "Add a URL mapping" group :apps, :info input :app, :desc => "Application to add the URL to", :argument => :optional, :from_given => by_name(:app) input :domain, :desc => "Domain to add the route to", :argument => true def map app = input[:app] domain = input[:domain] with_progress("Updating #{c(app.name, :name)}") do app.urls << domain app.update! end end private def ask_app ask("Which application?", :choices => client.apps, :display => proc(&:name)) end end end