changeset 302:b4b22dd087dc

refactored, unit tests pass
author catherine@dellzilla
date Tue, 26 Jan 2010 18:11:12 -0500
parents 30af90fd46c5
children c3b9b2256dd6
files cmd2.py
diffstat 1 files changed, 4 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- 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: