-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
bpo-21150: add quick link/summary table to the top of argparse documentation #12005
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
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
82ef37b
added summary tables to argparse documentation
suhearsawho 5e75aa3
📜🤖 Added by blurb_it.
blurb-it[bot] 427d6f6
removed whitespaces
suhearsawho 3a78f0d
Merge branch 'bpo-21150' of https://github.com/suhearsawho/cpython in…
suhearsawho 2d96d83
Changed core functionality table into sentences based on merwok's rec…
suhearsawho 95984c3
removed tabs
suhearsawho da29e79
reverted change from old commit
suhearsawho 8b35e39
Wrapped long lines of paragraphs under Core functionality section and…
suhearsawho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Changed core functionality table into sentences based on merwok's rec…
…ommendation
- Loading branch information
commit 2d96d8313decb030ea13123e0541c3ef4d209804
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,11 +32,17 @@ Summary | |
Core Functionality | ||
^^^^^^^^^^^^^^^^^^ | ||
|
||
.. csv-table:: | ||
:header: "Name", "Commonly Used Arguments", "Example" | ||
The :mod:`argparse` module's support for command-line interfaces is built from the following: | ||
|
||
":class:`argparse.ArgumentParser`", "`prog`_, `description`_, `formatter_class`_", "``parser = argparse.ArgumentParser(prog='PROG', description='DESC', formatter_class=argparse.RawDescriptionHelpFormatter)``" | ||
":func:`ArgumentParser.add_argument`", "`name or flags`_, `action`_, `default`_, `type`_, `required`_, `help`_", "``parser.add_argument('-v', '--verbose', action='store_true', help='Show various debugging information')``" | ||
The :class:`argparse.ArgumentParser` creates a new :class:`ArgumentParser` object. Commonly used arguments include `prog`_, `description`_, and `formatter_class`_. For example, the user can create an instance of :class:`ArgumentParser` through the following:: | ||
|
||
>>> parser = argparse.ArgumentParser(prog='PROG', description='DESC', | ||
... formatter_class=argparse.RawDescriptionHelpFormatter) | ||
|
||
The :func:`ArgumentParser.add_argument` is a function that is used to define how a single command-line argument should be parsed. Commonly used arguments include `name or flags`_, `action`_, `default`_, `type`_, `required`_, and `help`_. An example of the function :func:`ArgumentParser.add_argument` is as follows:: | ||
|
||
>>> parser.add_argument('-v', '--verbose', action='store_true', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency please also use hanging indentation here, with a single argument per line. |
||
... help='Show various debugging information') | ||
|
||
JulienPalard marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Basic Usage of :func:`add_argument` | ||
|
@@ -744,7 +750,7 @@ The add_argument() method | |
The following sections describe how each of these are used. | ||
|
||
|
||
.. _name or flags: | ||
.. ref:`name or flags` | ||
|
||
name or flags | ||
^^^^^^^^^^^^^ | ||
merwok marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.