Skip to content

Commit 95bd80e

Browse files
authored
Merge pull request #351 from python-cmd2/bugfix/350
Pass the return value back through for wrapped functions.
2 parents ddad9eb + ed3ff0c commit 95bd80e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cmd2.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def with_argument_list(func):
380380
@functools.wraps(func)
381381
def cmd_wrapper(self, cmdline):
382382
lexed_arglist = parse_quoted_string(cmdline)
383-
func(self, lexed_arglist)
383+
return func(self, lexed_arglist)
384384

385385
cmd_wrapper.__doc__ = func.__doc__
386386
return cmd_wrapper
@@ -400,7 +400,7 @@ def arg_decorator(func):
400400
def cmd_wrapper(instance, cmdline):
401401
lexed_arglist = parse_quoted_string(cmdline)
402402
args, unknown = argparser.parse_known_args(lexed_arglist)
403-
func(instance, args, unknown)
403+
return func(instance, args, unknown)
404404

405405
# argparser defaults the program name to sys.argv[0]
406406
# we want it to be the name of our command
@@ -442,7 +442,7 @@ def arg_decorator(func):
442442
def cmd_wrapper(instance, cmdline):
443443
lexed_arglist = parse_quoted_string(cmdline)
444444
args = argparser.parse_args(lexed_arglist)
445-
func(instance, args)
445+
return func(instance, args)
446446

447447
# argparser defaults the program name to sys.argv[0]
448448
# we want it to be the name of our command

0 commit comments

Comments
 (0)