Author phawkins
Recipients Kotan, TD22057, bethard, catherine, elsdoerfer, eric.araujo, paul.j3, phawkins, wrobell
Date 2013-10-22.01:51:34
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1382406694.52.0.701510040378.issue9338@psf.upfronthosting.co.za>
In-reply-to
Content
I ran into this bug the first time I needed nargs + in a tool.  

I found of course that if the option with the nargs is followed by another option before the positional arguments it will work as expected.  But then the help would have to point this out, and it still could be used incorrectly (so then I get a mail about a bug in my tool.) ;-)>

My workaround was to use action=append instead of nargs, then user would just have to give the option for each nargs desired.  Since my use would be short this was OK.  But the usage message does not reflect the multiple use nature of this option

But what I expected to find in the doc was a way to specify the use of a separator char between the nargs option arguments.  For example specify that ',' is the separator arg (currently a space is the separator.)  So if option is -foo the cli could be:

myprog.py -foo bar1,bar2,bar3 pos1 pos2

(Of course I could just have the tool take a comma delimited single argument and parse it in the tool's logic, but again then a custom usage message would be needed.)

Has this solution been considered?
History
Date User Action Args
2013-10-22 01:51:34phawkinssetrecipients: + phawkins, bethard, wrobell, eric.araujo, TD22057, catherine, elsdoerfer, Kotan, paul.j3
2013-10-22 01:51:34phawkinssetmessageid: <1382406694.52.0.701510040378.issue9338@psf.upfronthosting.co.za>
2013-10-22 01:51:34phawkinslinkissue9338 messages
2013-10-22 01:51:34phawkinscreate