| | |
| | | import optparse |
| | | import argparse |
| | | import sys |
| | | import textwrap |
| | | |
| | |
| | | return command.run() |
| | | |
| | | class PViewsCommand(object): |
| | | usage = '%prog config_uri url' |
| | | description = """\ |
| | | Print, for a given URL, the views that might match. Underneath each |
| | | potentially matching route, list the predicates required. Underneath |
| | |
| | | """ |
| | | stdout = sys.stdout |
| | | |
| | | parser = optparse.OptionParser( |
| | | usage, |
| | | parser = argparse.ArgumentParser( |
| | | usage="%(prog)s config_uri url", |
| | | description=textwrap.dedent(description) |
| | | ) |
| | | |
| | | parser.add_argument('config_uri', |
| | | help='The URI to the configuration file.') |
| | | |
| | | bootstrap = (bootstrap,) # testing |
| | | |
| | | def __init__(self, argv, quiet=False): |
| | | self.quiet = quiet |
| | | self.options, self.args = self.parser.parse_args(argv[1:]) |
| | | self.args = self.parser.parse_args(argv[1:]) |
| | | |
| | | def out(self, msg): # pragma: no cover |
| | | if not self.quiet: |