Commit d818c39c authored by Antoine Millet's avatar Antoine Millet
Browse files

Implemented list_account method on CCConf class.

parent 65e2e19a
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -217,6 +217,22 @@ class CCConf(object):

            self._set_conf(login, conf, create=True)

    def list_accounts(self):
        '''
        List all registered accounts.

        :return: :class:`tuple` of :class:`str`, each item being an
            account login
        '''

        logins = []
        for filename in os.listdir(self._path):
            login, ext = os.path.splitext(filename)
            if ext == '.json':
                logins.append(login)

        return tuple(logins)


    class UnknownAccount(Exception):
        pass