summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/pscripts/pviews.rst8
-rw-r--r--pyramid/scripts/pviews.py12
2 files changed, 9 insertions, 11 deletions
diff --git a/docs/pscripts/pviews.rst b/docs/pscripts/pviews.rst
index b4de5c054..da4660779 100644
--- a/docs/pscripts/pviews.rst
+++ b/docs/pscripts/pviews.rst
@@ -3,11 +3,7 @@
.. _pviews_script:
-``pviews``
-----------
-
-.. program-output:: pviews --help
- :prompt:
- :shell:
+.. autoprogram:: pyramid.scripts.pviews:PViewsCommand.parser
+ :prog: pviews
.. seealso:: :ref:`displaying_matching_views`
diff --git a/pyramid/scripts/pviews.py b/pyramid/scripts/pviews.py
index 9018eddb4..81150a801 100644
--- a/pyramid/scripts/pviews.py
+++ b/pyramid/scripts/pviews.py
@@ -1,4 +1,4 @@
-import optparse
+import argparse
import sys
import textwrap
@@ -13,7 +13,6 @@ def main(argv=sys.argv, quiet=False):
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
@@ -28,16 +27,19 @@ class PViewsCommand(object):
"""
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: