Mercurial > hg > configuration
comparison configuration/configuration.py @ 114:d1911d9b5b19
if an option cannot be coerced to a type we should just not add a CLI handler for it
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 28 Jun 2012 14:54:29 -0700 |
parents | f7bc409add34 |
children | 56db0b2b90af |
comparison
equal
deleted
inserted
replaced
113:f7bc409add34 | 114:d1911d9b5b19 |
---|---|
406 def optparse_options(self, parser): | 406 def optparse_options(self, parser): |
407 """add optparse options to a OptionParser instance""" | 407 """add optparse options to a OptionParser instance""" |
408 for key, value in self.items(): | 408 for key, value in self.items(): |
409 try: | 409 try: |
410 handler = self.types[self.option_type(key)] | 410 handler = self.types[self.option_type(key)] |
411 except: | 411 except KeyError: |
412 # XXX print this for now | 412 # if an option can't be coerced to a type |
413 # ultimately, if an option can't be coerced to a type | |
414 # we should just not add a CLI handler for it | 413 # we should just not add a CLI handler for it |
415 print key, value | 414 continue |
416 raise | |
417 args, kw = handler(key, value) | 415 args, kw = handler(key, value) |
418 if not args: | 416 if not args: |
419 # No CLI interface | 417 # No CLI interface |
420 continue | 418 continue |
421 parser.add_option(*args, **kw) | 419 parser.add_option(*args, **kw) |