# 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/wiki.py
# INIT_CONTEXT = 1


import os
import os.path
import shutil
import logging
from wikked.commands.base import WikkedCommand, register_command
from wikked.wiki import INIT_CONTEXT
        from wikked.wiki import WikiParameters, Wiki
                 os.path.join(path, 'Sandbox.md')],
                {'message': "Initial commit"})


@register_command
class ResetCommand(WikkedCommand):
    def __init__(self):
        super(ResetCommand, self).__init__()
        self.name = 'reset'
        self.description = ("Re-generates the database and the full-text "
                            "search index.")

    def setupParser(self, parser):
        parser.add_argument(
                '--single-threaded',
                help="Run in single-threaded mode",
                action='store_true')
        parser.add_argument(
                '--index-only',
                help="Only reset the full-text search index",
                action='store_true')

    def run(self, ctx):
        parallel = not ctx.args.single_threaded
        if ctx.args.index_only:
            ctx.wiki.index.reset(ctx.wiki.getPages())
        else:
            ctx.wiki.reset(parallel=parallel)



# 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/wiki.py
# INIT_CONTEXT = 1


# Path: wikked/commands/manage.py
import os
import os.path
import shutil
import logging
from wikked.commands.base import WikkedCommand, register_command
from wikked.wiki import INIT_CONTEXT
        from wikked.wiki import WikiParameters, Wiki

                 os.path.join(path, 'Sandbox.md')],
                {'message': "Initial commit"})


@register_command
class ResetCommand(WikkedCommand):
    def __init__(self):
        super(ResetCommand, self).__init__()
        self.name = 'reset'
        self.description = ("Re-generates the database and the full-text "
                            "search index.")

    def setupParser(self, parser):
        parser.add_argument(
                '--single-threaded',
                help="Run in single-threaded mode",
                action='store_true')
        parser.add_argument(
                '--index-only',
                help="Only reset the full-text search index",
                action='store_true')

    def run(self, ctx):
        parallel = not ctx.args.single_threaded
        if ctx.args.index_only:
            ctx.wiki.index.reset(ctx.wiki.getPages())
        else:
            ctx.wiki.reset(parallel=parallel)



@register_command