Issue 1073198: Extension to optparse: options with optional arguments (original) (raw)
Created on 2004-11-25 14:18 by pollastri, last changed 2022-04-11 14:56 by admin. This issue is now closed.
Messages (3)
Author: pollastri (pollastri)
Date: 2004-11-25 14:18
When parsing command line options, I found very useful to have an option with a facultative value, able to do the following:
1-tell to me if the option was or was not seen on the command line, return the value None if the option was not seen;
2-if the option only was specified, return a default value.
3-if the option with a value was specified on the command line, return the specified value;
A way to reach this goal can be the addition of a new value for the options actions in module optparse, it may be something like "store_with_default".
Author: Greg Ward (gward)
Date: 2005-01-05 13:19
Logged In: YES user_id=14422
I don't know what "facultative" means, but what you want is optional option arguments. Don't worry, I want that feature too, and have even started implementing it on a branch of the Optik source repository. See http://sourceforge.net/tracker/?func=detail&aid=1050431&group_id=38019&atid=421100 for a similar feature request.
I'm leaving this open, since I haven't finished anything or merged it into the Python CVS. It could be a few months before there's any action here, and it certainly won't happen before Optik 1.6 / Python 2.5. Might require Optik 2.0, in which case I'm not certain when it'll get into Python.
Author: Neal Norwitz (nnorwitz) *
Date: 2007-03-16 06:11
Greg, since optik is maintained separately, it seems to make sense to close this and possibly create a new report in optik. http://sourceforge.net/projects/optik . Let me know if that's not how you want to handle bugs/feature requests.