mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
gh-138525: Support single-dash long options and prefix_chars in BooleanOptionalAction (GH-138692)
-nofoo is generated for -foo. ++no-foo is generated for ++foo. /nofoo is generated for /foo.
This commit is contained in:
parent
cde19e565c
commit
425fd85ca3
5 changed files with 102 additions and 4 deletions
|
|
@ -1445,8 +1445,18 @@ this API may be passed as the ``action`` parameter to
|
|||
>>> parser.parse_args(['--no-foo'])
|
||||
Namespace(foo=False)
|
||||
|
||||
Single-dash long options are also supported.
|
||||
For example, negative option ``-nofoo`` is automatically added for
|
||||
positive option ``-foo``.
|
||||
But no additional options are added for short options such as ``-f``.
|
||||
|
||||
.. versionadded:: 3.9
|
||||
|
||||
.. versionchanged:: next
|
||||
Added support for single-dash options.
|
||||
|
||||
Added support for alternate prefix_chars_.
|
||||
|
||||
|
||||
The parse_args() method
|
||||
-----------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue