Mercurial > python-cmd2
comparison cmd2.py @ 190:51c15fe803a4
synch
author | catherine@Elli.myhome.westell.com |
---|---|
date | Thu, 12 Feb 2009 04:27:39 -0500 |
parents | 06119abd352e |
children | 9d9e9ea88daf |
comparison
equal
deleted
inserted
replaced
189:06119abd352e | 190:51c15fe803a4 |
---|---|
58 for opt in option_list: | 58 for opt in option_list: |
59 optionParser.add_option(opt) | 59 optionParser.add_option(opt) |
60 optionParser.set_usage("%s [options] arg" % func.__name__.strip('do_')) | 60 optionParser.set_usage("%s [options] arg" % func.__name__.strip('do_')) |
61 def newFunc(instance, arg): | 61 def newFunc(instance, arg): |
62 try: | 62 try: |
63 opts, newArgList = optionParser.parse_args(arg.split()) | 63 opts, newArgList = optionParser.parse_args(arg.split()) # doesn't understand quoted strings shouldn't be dissected! |
64 newArgs = remainingArgs(arg, newArgList) | 64 newArgs = remainingArgs(arg, newArgList) # should it permit flags after args? |
65 except (optparse.OptionValueError, optparse.BadOptionError, | 65 except (optparse.OptionValueError, optparse.BadOptionError, |
66 optparse.OptionError, optparse.AmbiguousOptionError, | 66 optparse.OptionError, optparse.AmbiguousOptionError, |
67 optparse.OptionConflictError), e: | 67 optparse.OptionConflictError), e: |
68 print e | 68 print e |
69 optionParser.print_help() | 69 optionParser.print_help() |