184 Commits

Author SHA1 Message Date
Raymond Hettinger
41b223d29c bpo-9694: Fix misleading phrase "optional arguments" (GH-23858) 2020-12-23 09:40:56 -08:00
Raymond Hettinger
6afb730e2a bpo-29030: Document interaction between *choices* and *metavar*. (GH-23884) 2020-12-22 09:24:26 -08:00
Raymond Hettinger
b0398a4b7f bpo-42572: Improve argparse docs for the type parameter. (GH-23849) 2020-12-20 10:14:54 -08:00
Raymond Hettinger
752cdf21eb bpo-38843: Document behavior of default when the attribute is already set (GH-23653) 2020-12-06 18:29:08 -08:00
Raymond Hettinger
7f82f22eba bpo-42501: Revise the usage note for Enums with the choices (GH-23563) 2020-11-30 09:55:13 -08:00
SarahPythonista
8784d3300e Fix error in argparse documentation example (GH-17399)
Automerge-Triggered-By: @rhettinger
2020-08-28 11:47:58 -07:00
Vincent Férotin
344c2a75c1 bpo-41024: doc: Explicitly mention use of 'enum.Enum' as a valid container for '… (GH-20964)
…choices' argument of 'argparse.ArgumentParser.add_argument'.

Here's a short first proposal of doc. enhancement addressing [bpo-41024]().

Automerge-Triggered-By: @csabella
2020-06-20 05:55:05 -07:00
Albert
59f5022b5d bpo-17050: Remove documentation on argparse.REMAINDER (GH-18661)
Closes [Issue 17050]() by removing argparse.REMAINDER from the documentation, as discussed on the issue.

Automerge-Triggered-By: @rhettinger
2020-05-24 11:57:40 -07:00
Raymond Hettinger
04c79d6088 bpo-38678: Improve argparse example in tutorial (GH-17207) 2019-11-17 22:06:19 -08:00
Brandt Bucher
a0ed99bca8 bpo-38438: Simplify argparse "star nargs" usage. (GH-17106) 2019-11-11 12:47:48 -08:00
Batuhan Taşkaya
74142078b3 bpo-38531: document extend action's added version (GH-16865) 2019-10-20 13:13:54 -07:00
Adam J. Stewart
9e71917e02 bpo-26510: Add versionchanged for required arg of add_subparsers (GH-16588)
The `required` argument to `argparse.add_subparsers` was added in #3027. This PR specifies the earliest version of Python where it is available.


https://bugs.python.org/issue26510



Automerge-Triggered-By: @merwok
2019-10-06 19:08:48 -07:00
Rémi Lapeyre
6a517c6749 bpo-8538: Add support for boolean actions to argparse (GH-11478)
Co-Authored-By: remilapeyre <remi.lapeyre@henki.fr>
2019-09-13 11:17:43 +01:00
Hai Shi
b1a2abdb06 bpo-37908: Add an example of ArgumentParser.exit() (GH-15455)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
2019-09-12 16:34:24 +01:00
Hai Shi
f545638b57 bpo-9938: Add optional keyword argument exit_on_error to argparse.ArgumentParser (GH-15362)
Co-Authored-by: Xuanji Li <xuanji@gmail.com>


https://bugs.python.org/issue9938



Automerge-Triggered-By: @matrixise
2019-09-12 03:56:05 -07:00
Raymond Hettinger
84125fed2a bpo-16468: Clarify which objects can be passed to "choices" in argparse (GH-15566) 2019-08-29 00:58:08 -07:00
Zac Hatfield-Dodds
dffca9e925 bpo-26967: fix flag grouping with allow_abbrev=False (GH-14316)
The `allow_abbrev` option for ArgumentParser is documented and intended to disable support for unique prefixes of --options, which may sometimes be ambiguous due to deferred parsing.

However, the initial implementation also broke parsing of grouped short flags, such as `-ab` meaning `-a -b` (or `-a=b`).  Checking the argument for a leading `--` before rejecting it fixes this.

This was prompted by pytest-dev/pytest#5469, so a backport to at least 3.8 would be great 😄  
And this is my first PR to CPython, so please let me know if I've missed anything!


https://bugs.python.org/issue26967
2019-07-13 22:35:58 -07:00
Batuhan Taşkaya
aa32a7e111 bpo-23378: Add an extend action to argparse (GH-13305)
Add an extend action to argparse


https://bugs.python.org/issue23378
2019-05-21 10:47:42 -07:00
Serhiy Storchaka
913876d824 bpo-35054: Add yet more index entries for symbols. (GH-10121) 2018-10-28 13:41:26 +02:00
Anthony Sottile
cc18258daf Fix doc for add_subparsers arguments (GH-8884)
There was a missing comma.
2018-08-23 20:08:54 -07:00
Ned Deily
8ebf5ceb0f bpo-33109: argparse subparsers are once again not required by default (GH-6919)
bpo-26510 in 3.7.0a2 changed the behavior of argparse to make
subparsers required by default, returning to the behavior of 2.7
and 3.2. The behavior was changed in 3.3 to be no longer required.
While it might make more sense to have the default to required,
compatibility with 3.3 through 3.6 is probably less disruptive
than trying to reintroduce compatibility with 2.7 at this point.
This change restores the 3.6 behavior.
2018-05-23 21:55:15 -04:00
suic86
04e8293465 Fix error messages in argparse examples (GH-6435)
The examples in argparse documentation use `error: too few arguments`
error message which was removed in this commit f97c59a in 2011.
2018-04-11 13:45:04 -05:00
Julien Palard
78553138be Fix typos '.::' should typically just be '::'. (GH-6165) 2018-03-28 23:14:15 +02:00
Anthony Sottile
aaf6fc0982 bpo-26510: make argparse subparsers required by default (#3027)
This fixes a regression from Python 2.  To get optional subparsers,
use the new parameter ``add_subparsers(required=False)``.

Patch by Anthony Sottile.
2017-09-20 17:35:27 -04:00
Elena Oat
397c467c49 bpo-31330: Clarify that RawTextHelpFormatter collapses repeated newlines. (#3272)
Also provide a solution if the user wants to keep multiple blank lines.
2017-09-07 16:06:45 -04:00