jw-pkg.sh: Print help for missing subcommands

Print a help message if no subcommand is specified for one of the
comamnds "distro" and "projects".

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-23 07:19:45 +01:00
commit c8036ad216
4 changed files with 16 additions and 2 deletions

View file

@ -20,6 +20,7 @@ class Cmd(abc.ABC): # export
self.__help = help
self.__children: list[Cmd] = []
self.__child_classes: list[type[Cmd]] = []
self.__parser: ArgumentParser|None = None
@abc.abstractmethod
async def _run(self, args) -> None:
@ -50,6 +51,14 @@ class Cmd(abc.ABC): # export
parent = parent.__parent
return self.__app
# Don't use a setter decorator to force using a grepable method
def set_parser(self, parser: ArgumentParser):
self.__parser = parser
@property
def parser(self) -> str:
return self.__parser
@property
def name(self) -> str:
return self.__name