Skip to content

Commit 4e2fb7b

Browse files
GH-58058: Add quick reference for ArgumentParser to argparse docs (gh-124227)
1 parent 9968caa commit 4e2fb7b

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Doc/library/argparse.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ will figure out how to parse those out of :data:`sys.argv`. The :mod:`argparse`
2525
module also automatically generates help and usage messages. The module
2626
will also issue errors when users give the program invalid arguments.
2727

28+
Quick Links for ArgumentParser
29+
---------------------------------------
30+
========================= =========================================================================================================== ==================================================================================
31+
Name Description Values
32+
========================= =========================================================================================================== ==================================================================================
33+
prog_ The name of the program Defaults to ``os.path.basename(sys.argv[0])``
34+
usage_ The string describing the program usage
35+
description_ A brief description of what the program does
36+
epilog_ Additional description of the program after the argument help
37+
parents_ A list of :class:`ArgumentParser` objects whose arguments should also be included
38+
formatter_class_ A class for customizing the help output ``argparse.HelpFormatter``
39+
prefix_chars_ The set of characters that prefix optional arguments Defaults to ``'-'``
40+
fromfile_prefix_chars_ The set of characters that prefix files to read additional arguments from Defaults to ``None`` (meaning arguments will never be treated as file references)
41+
argument_default_ The global default value for arguments
42+
allow_abbrev_ Allows long options to be abbreviated if the abbreviation is unambiguous ``True`` or ``False`` (default: ``True``)
43+
conflict_handler_ The strategy for resolving conflicting optionals
44+
add_help_ Add a ``-h/--help`` option to the parser ``True`` or ``False`` (default: ``True``)
45+
exit_on_error_ Determines whether or not to exit with error info when an error occurs ``True`` or ``False`` (default: ``True``)
46+
========================= =========================================================================================================== ==================================================================================
2847

2948
Core Functionality
3049
------------------

0 commit comments

Comments
 (0)