lib/shelly/cli/main.rb in shelly-0.0.21.pre5 vs lib/shelly/cli/main.rb in shelly-0.0.21
- old
+ new
@@ -45,29 +45,26 @@
desc "login [EMAIL]", "Logs user in to Shelly Cloud"
def login(email = nil)
user = Shelly::User.new(email || ask_for_email, ask_for_password(:with_confirmation => false))
user.login
say "Login successful"
- begin user.upload_ssh_key
- conflict = false
- rescue RestClient::Conflict
- conflict = true
- end
- say "Uploading your public SSH key" if conflict == false
+ say "Uploading your public SSH key"
+ user.upload_ssh_key
say "You have following clouds available:", :green
user.apps.each do |app|
say " #{app["code_name"]}"
end
rescue Client::APIError => e
if e.validation?
e.each_error { |error| say_error "#{error}", :with_exit => false }
+ exit 1
end
if e.unauthorized?
say_error "Wrong email or password", :with_exit => false
say_error "You can reset password by using link:", :with_exit => false
say_error "#{e.url}", :with_exit => false
+ exit 1
end
- exit 1
end
method_option "code-name", :type => :string, :aliases => "-c",
:desc => "Unique code-name of your cloud"
method_option :databases, :type => :array, :aliases => "-d",