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): class KiwiCommandType(Enum):
INSTANCE = auto() INSTANCE = auto()
PROJECT = auto() PROJECT = auto()
PROJECTS = auto()
SERVICE = auto() SERVICE = auto()

View file

@ -11,13 +11,27 @@ _pass_instance = click.make_pass_decorator(
) )
_project_arg = click.argument( _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", "project_name",
metavar="[PROJECT]", metavar="[PROJECT]",
required=False, required=False,
type=str, type=str,
) )
_services_arg = click.argument( _services_arg_s = click.argument(
"service_names", "service_names",
metavar="[SERVICE]...", metavar="[SERVICE]...",
nargs=-1, nargs=-1,
@ -46,9 +60,12 @@ def kiwi_command(
if cmd_type is KiwiCommandType.PROJECT: if cmd_type is KiwiCommandType.PROJECT:
cmd = _project_arg(cmd) cmd = _project_arg(cmd)
elif cmd_type is KiwiCommandType.PROJECTS:
cmd = _projects_arg(cmd)
elif cmd_type is KiwiCommandType.SERVICE: elif cmd_type is KiwiCommandType.SERVICE:
cmd = _project_arg(cmd) cmd = _services_arg_p(cmd)
cmd = _services_arg(cmd) cmd = _services_arg_s(cmd)
return cmd return cmd