diff options
author | Eric Lin <anselor@gmail.com> | 2020-07-24 12:03:59 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 787a31931ed4c4a18ae66a570d396b12b2b7b525 (patch) | |
tree | 89c103c71177ad8b0cac2e1355866c05a6c0c743 /examples/modular_commands/commandset_custominit.py | |
parent | c05d2b0480f284a83dfe868b1aad3d780174c289 (diff) | |
download | cmd2-git-787a31931ed4c4a18ae66a570d396b12b2b7b525.tar.gz |
Updates the example to remove usage of the now remove ability to
register arbitrary functions as commands.
Added example that demonstrates use of each of the command decorators
with CommandSets.
Adds unit test that verifies that CommandSets containing decorators load
and process commands correctly.
Updated the constructor declaration for Cmd2ArgumentParser to explicitly
re-declare argparse constructor parameters.
Diffstat (limited to 'examples/modular_commands/commandset_custominit.py')
-rw-r--r-- | examples/modular_commands/commandset_custominit.py | 14 |
1 files changed, 1 insertions, 13 deletions
diff --git a/examples/modular_commands/commandset_custominit.py b/examples/modular_commands/commandset_custominit.py index d96c5f1c..fa26644b 100644 --- a/examples/modular_commands/commandset_custominit.py +++ b/examples/modular_commands/commandset_custominit.py @@ -2,19 +2,7 @@ """ A simple example demonstrating a loadable command set """ -from cmd2 import Cmd, CommandSet, Statement, register_command, with_category, with_default_category - - -@register_command -@with_category("AAA") -def do_another_command(cmd: Cmd, statement: Statement): - """ - This is an example of registering an unbound function - :param cmd: - :param statement: - :return: - """ - cmd.poutput('Another Unbound Command: {}'.format(statement.args)) +from cmd2 import Cmd, CommandSet, Statement, with_category, with_default_category @with_default_category('Custom Init') |