diff --git a/src/python/jwutils/Cmd.py b/src/python/jwutils/Cmd.py index c360c09..74907f1 100644 --- a/src/python/jwutils/Cmd.py +++ b/src/python/jwutils/Cmd.py @@ -45,9 +45,9 @@ class Cmd(abc.ABC): # export def add_subcommands(self, cmd: str | type[Cmd] | list[type[Cmd]]) -> None: if isinstance(cmd, str): - sc = [] + sc: list[type[Cmd]] = [] for name, obj in inspect.getmembers(sys.modules[self.__class__.__module__]): - if inspect.isclass(obj): + if inspect.isclass(obj) and issubclass(obj, Cmd): if re.search(cmd, str(obj)): sc.append(obj) log.slog(log.DEBUG, f"Found subcommand {obj}")