diff options
author | Eric Lin <anselor@gmail.com> | 2020-06-14 11:05:24 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 9ad174a173fdc610c661d588c1f42decbb3d7f5e (patch) | |
tree | d380a4101d126b0bdc40e49a81832bef06f2efef /examples | |
parent | c88de7dfcfed716e81d06775b6e7929e4e01428c (diff) | |
download | cmd2-git-9ad174a173fdc610c661d588c1f42decbb3d7f5e.tar.gz |
Fixes issue with locating help_ annd complete_ functions when autoloading command functions
Adds handling of some edge cases. More thorough test coverage.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/modular_commands/commandset_basic.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/examples/modular_commands/commandset_basic.py b/examples/modular_commands/commandset_basic.py index 8b51b7e4..01ce1b39 100644 --- a/examples/modular_commands/commandset_basic.py +++ b/examples/modular_commands/commandset_basic.py @@ -11,8 +11,21 @@ from cmd2.utils import CompletionError @register_command @with_category("AAA") def do_unbound(cmd: Cmd, statement: Statement): + """This is an example of registering an unbound function + + :param cmd: + :param statement: + :return: + """ + cmd.poutput('Unbound Command: {}'.format(statement.args)) + + +@register_command +@with_category("AAA") +def do_func_with_help(cmd: Cmd, statement: Statement): """ This is an example of registering an unbound function + :param cmd: :param statement: :return: @@ -20,6 +33,10 @@ def do_unbound(cmd: Cmd, statement: Statement): cmd.poutput('Unbound Command: {}'.format(statement.args)) +def help_func_with_help(cmd: Cmd): + cmd.poutput('Help for func_with_help') + + @with_default_category('Basic Completion') class BasicCompletionCommandSet(CommandSet): # List of strings used with completion functions |