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:
parent
10e600a4ac
commit
ef593d6cd9
2 changed files with 21 additions and 3 deletions
|
@ -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()
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue