8000 GH-58058: Add quick reference for `ArgumentParser` to argparse docs by savannahostrowski · Pull Request #124227 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-58058: Add quick reference for ArgumentParser to argparse docs #124227

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Sep 25, 2024
Next Next commit
add quick reference for ArgumentParser
  • Loading branch information
savannahostrowski committed Sep 18, 2024
commit 8b616934b4da16f932cbe9ca7f9640bfb26048b9
22 changes: 20 additions & 2 deletions Doc/library/argparse.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@
module also automatically generates help and usage messages. The module
will also issue errors when users give the program invalid arguments.

Quick Links for :class:`ArgumentParser`
--------------------------------

Check warning on line 29 in Doc/library/argparse.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Title underline too short.
========================= =========================================================================================================== ==================================================================================
Name Description Values
========================= =========================================================================================================== ==================================================================================
prog_ The name of the program Defaults to ``os.path.basename(sys.argv[0])``
usage_ The string describing the program usage
description_ A brief description of what the program does. Displayed between the usage_ and argument help
epilog_ Additional description of the program after the argument help
parents_ A list of :class:`ArgumentParser` objects whose arguments should also be included
formatter_class_ A class for customizing the help output :class:`~argparse.HelpFormatter`
prefix_chars_ The set of characters that prefix optional arguments Defaults to ``'-'``
fromfile_prefix_chars_ The set of characters that prefix files from which additional arguments should be read Defaults to ``None`` (meaning arguments will never be treated as file references)
argument_default_ The global default value for arguments
allow_abbrev_ Allows long options to be abbreviated if the abbreviation is unambiguous ``True`` or ``False`` (default: ``True``)
conflict_handler_ The strategy for resolving conflicting optionals
add_help_ Add a ``-h/--help`` option to the parser ``True`` or ``False`` (default: ``True``)
exit_on_error_ Determines whether or not to exit with error info when an error occurs ``True`` or ``False`` (default: ``True``)
========================= =============================================================================================================

Core Functionality
------------------
Expand Down Expand Up @@ -53,9 +72,8 @@
args = parser.parse_args()
print(args.filename, args.count, args.verbose)


Quick Links for add_argument()
Quick Links for :meth:`add_argument`

Check warning on line 75 in Doc/library/argparse.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

py:meth reference target not found: add_argument [ref.meth]
------------------------------

Check warning on line 76 in Doc/library/argparse.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Title underline too short.

Check warning on line 76 in Doc/library/argparse.rst

View workflow job for this annotation

GitHub Actions / Docs / Docs

Title underline too short.

============================ =========================================================== ==========================================================================================================================
Name Description Values
Expand Down
Loading
0