diff options
author | Raymond Hettinger <python@rcn.com> | 2010-12-18 09:41:32 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2010-12-18 09:41:32 (GMT) |
commit | 3094ed8c6934f40ab7583c1c56c1aa99f71bac38 (patch) | |
tree | cddb3daef434283bf43e4397a5a19cdecd7c9ed5 /Doc/whatsnew | |
parent | 52d1b4e62fd35e19d4f2c231fe48d463cb83d374 (diff) | |
download | cpython-3094ed8c6934f40ab7583c1c56c1aa99f71bac38.zip cpython-3094ed8c6934f40ab7583c1c56c1aa99f71bac38.tar.gz cpython-3094ed8c6934f40ab7583c1c56c1aa99f71bac38.tar.bz2 |
Enhance argparse example to show aliases.
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.2.rst | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 507750b..bfc4e0d 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -1,4 +1,4 @@ -**************************** +http://news.blogs.cnn.com/2010/12/17/final-lunar-eclipse-of-2010-set-for-early-morning-of-december-21/?hpt=T2http://news.blogs.cnn.com/2010/12/17/final-lunar-eclipse-of-2010-set-for-early-morning-of-december-21/?hpt=T2**************************** What's New In Python 3.2 **************************** @@ -149,14 +149,15 @@ each with their own argument patterns and help displays:: parser_l.add_argument('-m', '--missiles', action='store_true') parser_l.add_argument('-t', '--torpedos', action='store_true') - parser_m = subparsers.add_parser('move', help='Move Vessel') # second subgroup + parser_m = subparsers.add_parser('move', help='Move Vessel', # second subgroup + aliases=('steer', 'turn')) # equivalent names parser_m.add_argument('-c', '--course', type=int, required=True) parser_m.add_argument('-s', '--speed', type=int, default=0) $ ./helm.py --help # top level help (launch and move) $ ./helm.py launch --help # help for launch options $ ./helm.py launch --missiles # set missiles=True and torpedos=False - $ ./helm.py move --course 180 --speed 5 # set movement parameters + $ ./helm.py steer --course 180 --speed 5 # set movement parameters .. seealso:: |