comparison cmd2.py @ 417:db32ab37051b

use exception inheritence instead of listing all optparse exceptions
author catherine.devlin@gmail.com
date Wed, 02 Feb 2011 08:00:26 -0500
parents a9f936346399
children b5f904daae83
comparison
equal deleted inserted replaced
416:a9f936346399 417:db32ab37051b
133 newArgs = remaining_args(arg, newArgList) 133 newArgs = remaining_args(arg, newArgList)
134 if isinstance(arg, ParsedString): 134 if isinstance(arg, ParsedString):
135 arg = arg.with_args_replaced(newArgs) 135 arg = arg.with_args_replaced(newArgs)
136 else: 136 else:
137 arg = newArgs 137 arg = newArgs
138 except (optparse.OptionValueError, optparse.BadOptionError, 138 except optparse.OptParseError, e:
139 optparse.OptionError, optparse.AmbiguousOptionError,
140 optparse.OptionConflictError), e:
141 print (e) 139 print (e)
142 optionParser.print_help() 140 optionParser.print_help()
143 return 141 return
144 if hasattr(opts, '_exit'): 142 if hasattr(opts, '_exit'):
145 return None 143 return None