# 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 re
from wikked.commands.base import WikkedCommand, register_command
        self.description = "Gets a page that matches the given URL."

    def setupParser(self, parser):
        parser.add_argument(
                'url',
                help="The URL of the page to get")
        parser.add_argument(
                '--raw',
                help="Get the raw text of the page.",
                action='store_true')
        parser.add_argument(
                '--rev',
                help="The revision to get")

    def run(self, ctx):
        page = ctx.wiki.getPage(ctx.args.url)
        if ctx.args.rev is not None:
            logger.info(page.getRevision(ctx.args.rev))
            return
        if ctx.args.raw:
            logger.info(page.raw_text)
        else:
            logger.info(page.text)


@register_command
class SearchCommand(WikkedCommand):
    def __init__(self):
        super(SearchCommand, self).__init__()
        self.name = 'search'

# 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/query.py
import logging
                import re
from wikked.commands.base import WikkedCommand, register_command

        self.description = "Gets a page that matches the given URL."

    def setupParser(self, parser):
        parser.add_argument(
                'url',
                help="The URL of the page to get")
        parser.add_argument(
                '--raw',
                help="Get the raw text of the page.",
                action='store_true')
        parser.add_argument(
                '--rev',
                help="The revision to get")

    def run(self, ctx):
        page = ctx.wiki.getPage(ctx.args.url)
        if ctx.args.rev is not None:
            logger.info(page.getRevision(ctx.args.rev))
            return
        if ctx.args.raw:
            logger.info(page.raw_text)
        else:
            logger.info(page.text)


@register_command
class SearchCommand(WikkedCommand):
    def __init__(self):
        super(SearchCommand, self).__init__()
        self.name = 'search'

        self.description = "Searches the wiki."