mirror of
https://github.com/yavook/kiwi-scp.git
synced 2024-11-22 04:43:00 +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:
|
except ImportError:
|
||||||
return
|
return
|
||||||
|
|
||||||
for cmd_name in dir(cmd_module):
|
member_name = f"{cmd_name.capitalize()}Command"
|
||||||
member = getattr(cmd_module, cmd_name)
|
|
||||||
|
if member_name in dir(cmd_module):
|
||||||
|
member = getattr(cmd_module, member_name)
|
||||||
|
|
||||||
if isinstance(member, click.Command):
|
if isinstance(member, click.Command):
|
||||||
return member
|
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",
|
help=f"skip confirmation",
|
||||||
)
|
)
|
||||||
@kiwi_command()
|
@kiwi_command()
|
||||||
class DisableCommand(KiwiCommand):
|
class EnableCommand(KiwiCommand):
|
||||||
"""Enable project(s)"""
|
"""Enable project(s)"""
|
||||||
|
|
||||||
type = KiwiCommandType.PROJECTS
|
type = KiwiCommandType.PROJECTS
|
||||||
|
|
Loading…
Reference in a new issue