summaryrefslogtreecommitdiffstats
path: root/Doc/library/argparse.rst
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-07-26 09:18:21 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-07-26 09:18:21 (GMT)
commit1050d2d0c7730c6c533246bb2404937739a7775c (patch)
tree68d901cd196aead4df7c3b074ebf2df6e85678e7 /Doc/library/argparse.rst
parent87ec85f4208bf329e6454fd3e2639c613b2b61af (diff)
downloadcpython-1050d2d0c7730c6c533246bb2404937739a7775c.zip
cpython-1050d2d0c7730c6c533246bb2404937739a7775c.tar.gz
cpython-1050d2d0c7730c6c533246bb2404937739a7775c.tar.bz2
Issue #26462: Doc: reduce literal_block warnings, fix syntax highlighting.
Patch by Julien Palard.
Diffstat (limited to 'Doc/library/argparse.rst')
-rw-r--r--Doc/library/argparse.rst20
1 files changed, 15 insertions, 5 deletions
diff --git a/Doc/library/argparse.rst b/Doc/library/argparse.rst
index 10789e9..995c4ee 100644
--- a/Doc/library/argparse.rst
+++ b/Doc/library/argparse.rst
@@ -45,7 +45,9 @@ produces either the sum or the max::
print(args.accumulate(args.integers))
Assuming the Python code above is saved into a file called ``prog.py``, it can
-be run at the command line and provides useful help messages::
+be run at the command line and provides useful help messages:
+
+.. code-block:: shell-session
$ python prog.py -h
usage: prog.py [-h] [--sum] N [N ...]
@@ -60,7 +62,9 @@ be run at the command line and provides useful help messages::
--sum sum the integers (default: find the max)
When run with the appropriate arguments, it prints either the sum or the max of
-the command-line integers::
+the command-line integers:
+
+.. code-block:: shell-session
$ python prog.py 1 2 3 4
4
@@ -68,7 +72,9 @@ the command-line integers::
$ python prog.py 1 2 3 4 --sum
10
-If invalid arguments are passed in, it will issue an error::
+If invalid arguments are passed in, it will issue an error:
+
+.. code-block:: shell-session
$ python prog.py a b c
usage: prog.py [-h] [--sum] N [N ...]
@@ -194,7 +200,9 @@ invoked on the command line. For example, consider a file named
args = parser.parse_args()
The help for this program will display ``myprogram.py`` as the program name
-(regardless of where the program was invoked from)::
+(regardless of where the program was invoked from):
+
+.. code-block:: shell-session
$ python myprogram.py --help
usage: myprogram.py [-h] [--foo FOO]
@@ -596,7 +604,9 @@ the parser's help message. For example, consider a file named
args = parser.parse_args()
If ``-h`` or ``--help`` is supplied at the command line, the ArgumentParser
-help will be printed::
+help will be printed:
+
+.. code-block:: shell-session
$ python myprogram.py --help
usage: myprogram.py [-h] [--foo FOO]