comparison commandparser/command.py @ 4:5f31e56eebb6

add some int support
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 30 Mar 2012 09:46:46 -0700
parents 406183d93e48
children 005e073dc590
comparison
equal deleted inserted replaced
3:406183d93e48 4:5f31e56eebb6
225 action='store_false', default=True, 225 action='store_false', default=True,
226 help=help) 226 help=help)
227 elif value is False: 227 elif value is False:
228 parser.add_option('--%s' % key, action='store_true', 228 parser.add_option('--%s' % key, action='store_true',
229 default=False, help=help) 229 default=False, help=help)
230 elif isinstance(value, int):
231 help += ' [DEFAULT: %s]' % value
232 parser.add_option('--%s' % key, help=help,
233 type='int', default=value)
230 elif type(value) in set([type(()), type([])]): 234 elif type(value) in set([type(()), type([])]):
231 if value: 235 if value:
232 help += ' [DEFAULT: %s]' % value 236 help += ' [DEFAULT: %s]' % value
233 parser.add_option('--%s' % key, action='append', 237 parser.add_option('--%s' % key, action='append',
234 default=list(value), 238 default=list(value),