First step to registering a CommandSet, called by cmd2.Cmd. The commands defined in this class have not been added to the CLI object at this point. Subclasses can override this to perform any initialization requiring access to the Cmd object (e.g. configure commands and thei
(self, cmd: CmdT)
| 60 | return self._cmd_internal |
| 61 | |
| 62 | def on_register(self, cmd: CmdT) -> None: |
| 63 | """First step to registering a CommandSet, called by cmd2.Cmd. |
| 64 | |
| 65 | The commands defined in this class have not been added to the CLI object at this point. |
| 66 | Subclasses can override this to perform any initialization requiring access to the Cmd object |
| 67 | (e.g. configure commands and their parsers based on CLI state data). |
| 68 | |
| 69 | :param cmd: The cmd2 main application |
| 70 | :raises CommandSetRegistrationError: if CommandSet is already registered. |
| 71 | """ |
| 72 | if self._cmd_internal is not None: |
| 73 | raise CommandSetRegistrationError("This CommandSet has already been registered") |
| 74 | self._cmd_internal = cmd |
| 75 | |
| 76 | def on_registered(self) -> None: |
| 77 | """2nd step to registering, called by cmd2.Cmd after a CommandSet is registered and all its commands have been added. |
no test coverage detected