summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-12 15:45:41 -0700
committerGitHub <noreply@github.com>2018-04-12 15:45:41 -0700
commit95bd80efee7f4f607af4f58dec83024d5d6f78e1 (patch)
treeab8c02a417e611b8627ff1c393aa60e0db44ec97 /cmd2.py
parentddad9ebf9bc4f8158536719e9a4b8ca2e6753e51 (diff)
parented3ff0ca9150d2b446bd545042db7a6d367f0cd9 (diff)
downloadcmd2-git-95bd80efee7f4f607af4f58dec83024d5d6f78e1.tar.gz
Merge pull request #351 from python-cmd2/bugfix/350
Pass the return value back through for wrapped functions.
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 1cf13747..a082ca6f 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -380,7 +380,7 @@ def with_argument_list(func):
@functools.wraps(func)
def cmd_wrapper(self, cmdline):
lexed_arglist = parse_quoted_string(cmdline)
- func(self, lexed_arglist)
+ return func(self, lexed_arglist)
cmd_wrapper.__doc__ = func.__doc__
return cmd_wrapper
@@ -400,7 +400,7 @@ def with_argparser_and_unknown_args(argparser):
def cmd_wrapper(instance, cmdline):
lexed_arglist = parse_quoted_string(cmdline)
args, unknown = argparser.parse_known_args(lexed_arglist)
- func(instance, args, unknown)
+ return func(instance, args, unknown)
# argparser defaults the program name to sys.argv[0]
# we want it to be the name of our command
@@ -442,7 +442,7 @@ def with_argparser(argparser):
def cmd_wrapper(instance, cmdline):
lexed_arglist = parse_quoted_string(cmdline)
args = argparser.parse_args(lexed_arglist)
- func(instance, args)
+ return func(instance, args)
# argparser defaults the program name to sys.argv[0]
# we want it to be the name of our command