summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/pscripts/ptweens.rst8
-rw-r--r--pyramid/scripts/ptweens.py12
2 files changed, 9 insertions, 11 deletions
diff --git a/docs/pscripts/ptweens.rst b/docs/pscripts/ptweens.rst
index 02e23e49a..f586e1467 100644
--- a/docs/pscripts/ptweens.rst
+++ b/docs/pscripts/ptweens.rst
@@ -3,11 +3,7 @@
.. _ptweens_script:
-``ptweens``
------------
-
-.. program-output:: ptweens --help
- :prompt:
- :shell:
+.. autoprogram:: pyramid.scripts.ptweens:PTweensCommand.parser
+ :prog: ptweens
.. seealso:: :ref:`displaying_tweens`
diff --git a/pyramid/scripts/ptweens.py b/pyramid/scripts/ptweens.py
index a7aa009da..3f8c9871e 100644
--- a/pyramid/scripts/ptweens.py
+++ b/pyramid/scripts/ptweens.py
@@ -1,4 +1,4 @@
-import optparse
+import argparse
import sys
import textwrap
@@ -14,7 +14,6 @@ def main(argv=sys.argv, quiet=False):
return command.run()
class PTweensCommand(object):
- usage = '%prog config_uri'
description = """\
Print all implicit and explicit tween objects used by a Pyramid
application. The handler output includes whether the system is using an
@@ -28,17 +27,20 @@ class PTweensCommand(object):
will be assumed. Example: "ptweens myapp.ini#main".
"""
- parser = optparse.OptionParser(
- usage,
+ parser = argparse.ArgumentParser(
+ usage="%(prog)s config_uri",
description=textwrap.dedent(description),
)
+ parser.add_argument('config_uri',
+ help='The URI to the configuration file.')
+
stdout = sys.stdout
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 _get_tweens(self, registry):
from pyramid.config import Configurator