changeset 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
files commandparser/command.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/commandparser/command.py	Fri Mar 30 09:13:06 2012 -0700
+++ b/commandparser/command.py	Fri Mar 30 09:46:46 2012 -0700
@@ -227,6 +227,10 @@
                 elif value is False:
                     parser.add_option('--%s' % key, action='store_true',
                                       default=False, help=help)
+                elif isinstance(value, int):
+                    help += ' [DEFAULT: %s]' % value
+                    parser.add_option('--%s' % key, help=help,
+                                      type='int', default=value)
                 elif type(value) in set([type(()), type([])]):
                     if value:
                         help += ' [DEFAULT: %s]' % value