1
0
Fork 0
mirror of https://github.com/yavook/kiwi-scp.git synced 2024-11-24 05:33:00 +00:00

preparation for KiwiCommandType.PROJECTS

This commit is contained in:
Jörn-Michael Miehe 2021-12-01 13:07:35 +01:00
parent 10e600a4ac
commit ef593d6cd9
2 changed files with 21 additions and 3 deletions

View file

@ -194,4 +194,5 @@ class KiwiCommand:
class KiwiCommandType(Enum):
INSTANCE = auto()
PROJECT = auto()
PROJECTS = auto()
SERVICE = auto()

View file

@ -11,13 +11,27 @@ _pass_instance = click.make_pass_decorator(
)
_project_arg = click.argument(
"project_name",
metavar="PROJECT",
required=False, # TODO remove this line when PROJECTS logic is implemented
type=str,
)
_projects_arg = click.argument(
"project_names",
metavar="[PROJECT]...",
nargs=-1,
type=str,
)
_services_arg_p = click.argument(
"project_name",
metavar="[PROJECT]",
required=False,
type=str,
)
_services_arg = click.argument(
_services_arg_s = click.argument(
"service_names",
metavar="[SERVICE]...",
nargs=-1,
@ -46,9 +60,12 @@ def kiwi_command(
if cmd_type is KiwiCommandType.PROJECT:
cmd = _project_arg(cmd)
elif cmd_type is KiwiCommandType.PROJECTS:
cmd = _projects_arg(cmd)
elif cmd_type is KiwiCommandType.SERVICE:
cmd = _project_arg(cmd)
cmd = _services_arg(cmd)
cmd = _services_arg_p(cmd)
cmd = _services_arg_s(cmd)
return cmd