mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-12-24 18:22:59 +00:00
get_command member find method
This commit is contained in:
parent
558726f261
commit
3862ea1901
2 changed files with 10 additions and 3 deletions
|
@ -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")
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue