# File lib/rhc/commands/logout.rb, line 20
    def run
      if options.all
        rest_client.user # force authentication
        say "Deleting all authorizations associated with your account ... "
        begin
          rest_client.delete_authorizations
          success "done"
        rescue RHC::Rest::AuthorizationsNotSupported
          info "not supported"
        end
      elsif token_for_user
        options.noprompt = true
        say "Ending session on server ... "
        begin
          rest_client.delete_authorization(token_for_user)
          success "deleted"
        rescue RHC::Rest::AuthorizationsNotSupported
          info "not supported"
        rescue RHC::Rest::TokenExpiredOrInvalid
          info "already closed"
        rescue => e
          debug_error(e)
          warn e.message
        end
      end

      0
    ensure
      token_store.clear
      success "All local sessions removed."
    end