summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorJared Crapo <jared@kotfu.net>2018-01-10 23:17:46 -0700
committerJared Crapo <jared@kotfu.net>2018-01-10 23:17:46 -0700
commitde320b61a894736e58bc5d427564eddca70bfc8e (patch)
tree18b32e976d2d72d49aabb6f28d93cb5f4903afde /cmd2.py
parent0a03ab88f8bb70cc2f384c0b98a18bdead7bd417 (diff)
downloadcmd2-git-de320b61a894736e58bc5d427564eddca70bfc8e.tar.gz
Fix a nasty bug in @with_argument_parser
second argument of do_* methods was getting mangled when we strip quotes
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd2.py b/cmd2.py
index f5c1dab0..7540bd00 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -248,9 +248,9 @@ def with_argument_parser(argparser):
argparse.ArgumentParser.
"""
def arg_decorator(func):
- def cmd_wrapper(instance, arg):
+ def cmd_wrapper(instance, cmdline):
# Use shlex to split the command line into a list of arguments based on shell rules
- lexed_arglist = shlex.split(arg, posix=POSIX_SHLEX)
+ lexed_arglist = shlex.split(cmdline, posix=POSIX_SHLEX)
# If not using POSIX shlex, make sure to strip off outer quotes for convenience
if not POSIX_SHLEX and STRIP_QUOTES_FOR_NON_POSIX:
temp_arglist = []
@@ -258,7 +258,7 @@ def with_argument_parser(argparser):
temp_arglist.append(strip_quotes(arg))
lexed_arglist = temp_arglist
opts = argparser.parse_args(lexed_arglist)
- func(instance, arg, opts)
+ func(instance, cmdline, opts)
# argparser defaults the program name to sys.argv[0]
# we want it to be the name of our command