Message157148
I now set the help string for an
argparse option with two parameters:
parser.add_argument('-s', '--substitute', nargs=2,
help='Replace first string with second',
metavar='string')
which generates a help message
-s string string, --substitute string string
Replace first string with second
Instead I would *like* to generate the help message
-s fromString toString, --substitute fromString toString
Replace fromString with toString
At present metavar replaces each of multiple parameters with the same thing,
but with a fixed number of parameters it makes sense that each may have a
different meaning.
It seems to me that when nargs=k is set for an integer k,
we could have metavar be a list of k strings to go in the k places,
as in
parser.add_argument('-s', '--substitute', nargs=2,
help='Replace fromString with toString',
metavar=['fromString', 'toString'])
and have this generate my desired help message.
There is no need to break the current behavior:
The parser can distinguish a list from a single string.
The same text is in the attached file. |
|
Date |
User |
Action |
Args |
2012-03-30 20:32:10 | andyharrington | set | recipients:
+ andyharrington |
2012-03-30 20:32:10 | andyharrington | set | messageid: <1333139530.69.0.0400880123602.issue14454@psf.upfronthosting.co.za> |
2012-03-30 20:32:10 | andyharrington | link | issue14454 messages |
2012-03-30 20:32:10 | andyharrington | create | |
|