lib.Cmd.load_subcommands(): Add method

Push cmds.Cmd._add_subcommands() as lib.Cmd.load_subcommands() one step up to the top of the type hierarchy ladder.

By default, it does the same thing, i.e. load subcommands matching frobnicate.Cmd* if called on class CmdFrobnicate.

This commit also replaces invocations of Cmd._add_subcommands() by invocations of this new method.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-05-01 10:17:24 +02:00
commit 7e2099877c
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
8 changed files with 16 additions and 14 deletions

View file

@ -9,7 +9,7 @@ class CmdPosix(CmdBase): # export
def __init__(self, parent: App) -> None:
super().__init__(parent, 'posix', help='Perform various operations on a distro through its POSIX utility interface')
self._add_subcommands()
self.load_subcommands()
def add_arguments(self, p: ArgumentParser) -> None:
super().add_arguments(p)