lib/cli/commands/apps.rb in af-0.3.18.11 vs lib/cli/commands/apps.rb in af-0.3.18.12
- old
+ new
@@ -461,9 +461,23 @@
else
display 'OK'.green
end
end
+ def rename(oldname, newname)
+ # Check if new app name is taken
+ if newname
+ err "Application '#{newname}' already exists" if app_exists?(newname)
+ else
+ raise VMC::Client::AuthError unless client.logged_in?
+ end
+
+ app = client.app_info(oldname)
+ app[:name] = newname
+ client.update_app(oldname, app)
+ display "Successfully updated app name to #{newname}".green
+ end
+
private
def app_exists?(appname)
app_info = client.app_info(appname)
app_info != nil