summaryrefslogtreecommitdiff
path: root/cmd2
diff options
context:
space:
mode:
authorEric Lin <anselor@gmail.com>2020-08-27 17:07:43 -0400
committeranselor <anselor@gmail.com>2020-08-27 18:21:18 -0400
commit47f8652fa467b2d140b1097b3167f968b0188451 (patch)
tree81fe0931f4715463d87a06752f947bef771c00d0 /cmd2
parente3a07c59b541b4a0b937c62ef38be6d8c011c0a3 (diff)
downloadcmd2-git-47f8652fa467b2d140b1097b3167f968b0188451.tar.gz
the with_argparse() decorator was incorrectly using a parsed statement object to search for the original function arguments. Switched to search for the original statement value instead1.3.7
Diffstat (limited to 'cmd2')
-rw-r--r--cmd2/decorators.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/cmd2/decorators.py b/cmd2/decorators.py
index c2689102..4ee61754 100644
--- a/cmd2/decorators.py
+++ b/cmd2/decorators.py
@@ -35,7 +35,7 @@ def with_category(category: str) -> Callable:
return cat_decorator
##########################
-# The _parse_positionals and _swap_args decorators allow for additional positional args to be preserved
+# The _parse_positionals and _arg_swap functions allow for additional positional args to be preserved
# in cmd2 command functions/callables. As long as the 2-ple of arguments we expect to be there can be
# found we can swap out the statement with each decorator's specific parameters
##########################
@@ -276,9 +276,9 @@ def with_argparser(parser: argparse.ArgumentParser, *,
:return: return value of command function
:raises: Cmd2ArgparseError if argparse has error parsing command line
"""
- cmd2_app, statement = _parse_positionals(args)
+ cmd2_app, statement_arg = _parse_positionals(args)
statement, parsed_arglist = cmd2_app.statement_parser.get_command_arg_list(command_name,
- statement,
+ statement_arg,
preserve_quotes)
if ns_provider is None:
@@ -314,7 +314,7 @@ def with_argparser(parser: argparse.ArgumentParser, *,
if hasattr(ns, constants.NS_ATTR_SUBCMD_HANDLER):
delattr(ns, constants.NS_ATTR_SUBCMD_HANDLER)
- args_list = _arg_swap(args, statement, *new_args)
+ args_list = _arg_swap(args, statement_arg, *new_args)
return func(*args_list, **kwargs)
# argparser defaults the program name to sys.argv[0], but we want it to be the name of our command