get_command member find method

This commit is contained in:
Jörn-Michael Miehe 2022-01-19 15:35:33 +01:00
parent 558726f261
commit 3862ea1901
2 changed files with 10 additions and 3 deletions

View file

@ -26,9 +26,16 @@ class KiwiCLI(click.MultiCommand):
except ImportError:
return
for cmd_name in dir(cmd_module):
member = getattr(cmd_module, cmd_name)
member_name = f"{cmd_name.capitalize()}Command"
if member_name in dir(cmd_module):
member = getattr(cmd_module, member_name)
if isinstance(member, click.Command):
return member
else:
raise Exception("Fail class")
else:
raise Exception("Fail member name")

View file

@ -13,7 +13,7 @@ from ..project import Project
help=f"skip confirmation",
)
@kiwi_command()
class DisableCommand(KiwiCommand):
class EnableCommand(KiwiCommand):
"""Enable project(s)"""
type = KiwiCommandType.PROJECTS