diff options
author | Georg Brandl <georg@python.org> | 2009-09-17 16:26:06 +0000 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-09-17 16:26:06 +0000 |
commit | 6c3e6c0b0297af99aa0028a345920eb0db200ef2 (patch) | |
tree | 19d958b4b57dd5b55f3d122931c5473f8539195d /Doc | |
parent | 7fd6c493ccf257acb745736df072de115668282e (diff) | |
download | cpython-6c3e6c0b0297af99aa0028a345920eb0db200ef2.tar.gz |
Remove duplicate doc of enable/disable_interspersed_args.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/optparse.rst | 46 |
1 files changed, 19 insertions, 27 deletions
diff --git a/Doc/library/optparse.rst b/Doc/library/optparse.rst index a28d6dd36e..4a6fa392d1 100644 --- a/Doc/library/optparse.rst +++ b/Doc/library/optparse.rst @@ -1207,18 +1207,27 @@ and you can also poke around your option parser and see what's there. OptionParser provides several methods to help you out: ``disable_interspersed_args()`` - Set parsing to stop on the first non-option. Use this if you have a - command processor which runs another command which has options of - its own and you want to make sure these options don't get - confused. For example, each command might have a different - set of options. + Set parsing to stop on the first non-option. For example, if ``"-a"`` and + ``"-b"`` are both simple options that take no arguments, :mod:`optparse` + normally accepts this syntax:: + + prog -a arg1 -b arg2 + + and treats it as equivalent to :: + + prog -a -b arg1 arg2 + + To disable this feature, call ``disable_interspersed_args()``. This restores + traditional Unix syntax, where option parsing stops with the first non-option + argument. + + Use this if you have a command processor which runs another command which has + options of its own and you want to make sure these options don't get confused. + For example, each command might have a different set of options. ``enable_interspersed_args()`` - Set parsing to not stop on the first non-option, allowing - interspersing switches with command arguments. For example, - ``"-s arg1 --long arg2"`` would return ``["arg1", "arg2"]`` - as the command arguments and ``-s, --long`` as options. - This is the default behavior. + Set parsing to not stop on the first non-option, allowing interspersing + switches with command arguments. This is the default behavior. ``get_option(opt_str)`` Returns the Option instance with the option string ``opt_str``, or ``None`` if @@ -1329,23 +1338,6 @@ OptionParser supports several other public methods: constructor keyword argument. Passing ``None`` sets the default usage string; use ``SUPPRESS_USAGE`` to suppress a usage message. -* ``enable_interspersed_args()``, ``disable_interspersed_args()`` - - Enable/disable positional arguments interspersed with options, similar to GNU - getopt (enabled by default). For example, if ``"-a"`` and ``"-b"`` are both - simple options that take no arguments, :mod:`optparse` normally accepts this - syntax:: - - prog -a arg1 -b arg2 - - and treats it as equivalent to :: - - prog -a -b arg1 arg2 - - To disable this feature, call ``disable_interspersed_args()``. This restores - traditional Unix syntax, where option parsing stops with the first non-option - argument. - * ``set_defaults(dest=value, ...)`` Set default values for several option destinations at once. Using |