diff --git a/kiwi_scp/commands/cmd_list.py b/kiwi_scp/commands/cmd_list.py index 0918b0c..9b127bf 100644 --- a/kiwi_scp/commands/cmd_list.py +++ b/kiwi_scp/commands/cmd_list.py @@ -1,3 +1,5 @@ +from typing import Tuple + import click from ..instance import Instance, pass_instance @@ -10,12 +12,9 @@ from ..misc import service_command ) @pass_instance @service_command -def cmd(ctx: Instance, project: str, service: str): +def cmd(ctx: Instance, project: str, services: Tuple[str]): """List projects in this instance, services inside a project or service(s) inside a project""" if project is not None: - if service is not None: - print(f"{ctx.get_service(project, service)}") - else: - print(f"services: {ctx.get_services(project)}") + print(ctx.get_services(project, services)) else: print(f"projects: {ctx.config.projects}") diff --git a/kiwi_scp/misc.py b/kiwi_scp/misc.py index c4895f0..dccc434 100644 --- a/kiwi_scp/misc.py +++ b/kiwi_scp/misc.py @@ -27,15 +27,16 @@ _project_arg = click.argument( type=str, ) -_service_arg = click.argument( - "service", - required=False, +_services_arg = click.argument( + "services", + metavar="[SERVICE]...", + nargs=-1, type=str, ) instance_command = _MultiDecorator([]) project_command = _MultiDecorator([_project_arg]) -service_command = _MultiDecorator([_project_arg, _service_arg]) +service_command = _MultiDecorator([_project_arg, _services_arg]) def user_query(description: str, default: Any, cast_to: Type[Any] = str):