diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-23 16:26:38 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-03-23 16:26:38 -0400 |
commit | 55fa6ee0632d8126f081cfed204fde0f0bd0b70c (patch) | |
tree | 10a01dc45e8b1c6860d4e63c2f60a9e6e0f155ee | |
parent | 0a16f8a9389bd626b69ca442f942a8f86b90fa3d (diff) | |
parent | 966d6a53e87147e2db9424c0f0060ca7e20e690f (diff) | |
download | cmd2-git-55fa6ee0632d8126f081cfed204fde0f0bd0b70c.tar.gz |
Merge branch 'master' into new_quoted_completion
-rwxr-xr-x | examples/subcommands.py | 5 | ||||
-rw-r--r-- | tests/test_completion.py | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/examples/subcommands.py b/examples/subcommands.py index 2a7e0afa..bc82b548 100755 --- a/examples/subcommands.py +++ b/examples/subcommands.py @@ -63,9 +63,10 @@ class SubcommandsExample(cmd2.Cmd): @with_argparser(base_parser) def do_base(self, args): """Base command help""" - if args.func is not None: + func = getattr(args, 'func', None) + if func is not None: # Call whatever subcommand function was selected - args.func(self, args) + func(self, args) else: # No subcommand was provided, so call help self.do_help('base') diff --git a/tests/test_completion.py b/tests/test_completion.py index aa32d444..8b9eba63 100644 --- a/tests/test_completion.py +++ b/tests/test_completion.py @@ -650,9 +650,10 @@ class SubcommandsExample(cmd2.Cmd): @cmd2.with_argparser(base_parser) def do_base(self, args): """Base command help""" - if args.func is not None: - # Call whatever sub-command function was selected - args.func(self, args) + func = getattr(args, 'func', None) + if func is not None: + # Call whatever subcommand function was selected + func(self, args) else: # No sub-command was provided, so as called self.do_help('base') |