From 9d309939286f4944cb083dfd4f320c442bc99d76 Mon Sep 17 00:00:00 2001 From: anselor Date: Sat, 1 Aug 2020 16:26:11 -0400 Subject: Now maintains a command->CommandSet mapping and passes the CommandSet through to the ArgparseCompleter if one is registered. For subcommands, the registered argparse instance for the subcommand is now tagged with the CommandSet from which it originated. If a CommandSet is detected, it's now passed in as 'self' for the completion functions. Fixes some issue found with removing a subcommand. Adds additional tests. Added a check to prevent removal of a CommandSet if it has commands with sub-commands from another CommandSet bound to it. Documentation improvements. Standardized around using CommandSetRegistrationException during commandset install/uninstall related errors. Added support for nested sub-command injection. --- cmd2/exceptions.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'cmd2/exceptions.py') diff --git a/cmd2/exceptions.py b/cmd2/exceptions.py index 8a7fd81f..c1815e1b 100644 --- a/cmd2/exceptions.py +++ b/cmd2/exceptions.py @@ -24,6 +24,9 @@ class Cmd2ArgparseError(SkipPostcommandHooks): pass +class CommandSetRegistrationError(Exception): + pass + ############################################################################################################ # The following exceptions are NOT part of the public API and are intended for internal use only. ############################################################################################################ -- cgit v1.2.1