# Path: wikked/bcryptfallback.py
# def generate_password_hash(password):
#     return hashlib.sha512(password.encode('utf8')).hexdigest()
# 
# Path: wikked/commands/base.py
# class WikkedCommand(object):
#     def __init__(self):
#         self.name = None
#         self.description = None
#         self.requires_wiki = True
# 
#     def setupParser(self, parser):
#         raise NotImplementedError()
# 
#     def run(self, ctx):
#         raise NotImplementedError()
# 
#     def _doRun(self, ctx):
#         if ctx.wiki is None and self.requires_wiki:
#             raise Exception("No wiki found here.")
#         result = self.run(ctx)
#         if result is None:
#             result = 0
#         return result
# 
# def register_command(cls):
#     command_classes.append(cls)
#     return cls


import logging
import getpass
from wikked.bcryptfallback import generate_password_hash
from wikked.commands.base import WikkedCommand, register_command


logger = logging.getLogger(__name__)


@register_command
class UsersCommand(WikkedCommand):
    def __init__(self):
        super(UsersCommand, self).__init__()
        self.name = 'users'
        self.description = "Lists users of this wiki."

    def setupParser(self, parser):
        pass

    def run(self, ctx):
        logger.info("Users:")
        for user in ctx.wiki.auth.getUsers():
            logger.info(" - " + user.username)


@register_command

# Path: wikked/bcryptfallback.py
# def generate_password_hash(password):
#     return hashlib.sha512(password.encode('utf8')).hexdigest()
# 
# Path: wikked/commands/base.py
# class WikkedCommand(object):
#     def __init__(self):
#         self.name = None
#         self.description = None
#         self.requires_wiki = True
# 
#     def setupParser(self, parser):
#         raise NotImplementedError()
# 
#     def run(self, ctx):
#         raise NotImplementedError()
# 
#     def _doRun(self, ctx):
#         if ctx.wiki is None and self.requires_wiki:
#             raise Exception("No wiki found here.")
#         result = self.run(ctx)
#         if result is None:
#             result = 0
#         return result
# 
# def register_command(cls):
#     command_classes.append(cls)
#     return cls


# Path: wikked/commands/users.py
import logging
import getpass
from wikked.bcryptfallback import generate_password_hash
from wikked.commands.base import WikkedCommand, register_command



logger = logging.getLogger(__name__)


@register_command
class UsersCommand(WikkedCommand):
    def __init__(self):
        super(UsersCommand, self).__init__()
        self.name = 'users'
        self.description = "Lists users of this wiki."

    def setupParser(self, parser):
        pass

    def run(self, ctx):
        logger.info("Users:")
        for user in ctx.wiki.auth.getUsers():
            logger.info(" - " + user.username)


@register_command

class NewUserCommand(WikkedCommand):