# HG changeset patch # User catherine@dellzilla # Date 1264547472 18000 # Node ID b4b22dd087dc3727157b8d280881af522c407567 # Parent 30af90fd46c5f2b7ef771fabd53ea43782ccd726 refactored, unit tests pass diff -r 30af90fd46c5 -r b4b22dd087dc cmd2.py --- a/cmd2.py Tue Jan 26 18:04:20 2010 -0500 +++ b/cmd2.py Tue Jan 26 18:11:12 2010 -0500 @@ -112,17 +112,12 @@ optionParser._func = func def new_func(instance, arg): try: - if hasattr(arg, 'parsed'): - args = arg.parsed.raw - else: - print 'raw arg passed to new_func!' - args = arg - opts, newArgList = optionParser.parse_args(args.split()) + opts, newArgList = optionParser.parse_args(arg.split()) # Must find the remaining args in the original argument list, but # mustn't include the command itself - if hasattr(arg, 'parsed') and newArgList[0] == arg.parsed.command: - newArgList = newArgList[1:] - newArgs = remaining_args(args, newArgList) + #if hasattr(arg, 'parsed') and newArgList[0] == arg.parsed.command: + # newArgList = newArgList[1:] + newArgs = remaining_args(arg, newArgList) if isinstance(arg, ParsedString): arg = arg.with_args_replaced(newArgs) else: