more streamlined "list" command, but "list <project>" doesn't work
This commit is contained in:
parent
ed29243b71
commit
fc55e9d677
2 changed files with 9 additions and 9 deletions
|
@ -1,3 +1,5 @@
|
||||||
|
from typing import Tuple
|
||||||
|
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from ..instance import Instance, pass_instance
|
from ..instance import Instance, pass_instance
|
||||||
|
@ -10,12 +12,9 @@ from ..misc import service_command
|
||||||
)
|
)
|
||||||
@pass_instance
|
@pass_instance
|
||||||
@service_command
|
@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"""
|
"""List projects in this instance, services inside a project or service(s) inside a project"""
|
||||||
if project is not None:
|
if project is not None:
|
||||||
if service is not None:
|
print(ctx.get_services(project, services))
|
||||||
print(f"{ctx.get_service(project, service)}")
|
|
||||||
else:
|
|
||||||
print(f"services: {ctx.get_services(project)}")
|
|
||||||
else:
|
else:
|
||||||
print(f"projects: {ctx.config.projects}")
|
print(f"projects: {ctx.config.projects}")
|
||||||
|
|
|
@ -27,15 +27,16 @@ _project_arg = click.argument(
|
||||||
type=str,
|
type=str,
|
||||||
)
|
)
|
||||||
|
|
||||||
_service_arg = click.argument(
|
_services_arg = click.argument(
|
||||||
"service",
|
"services",
|
||||||
required=False,
|
metavar="[SERVICE]...",
|
||||||
|
nargs=-1,
|
||||||
type=str,
|
type=str,
|
||||||
)
|
)
|
||||||
|
|
||||||
instance_command = _MultiDecorator([])
|
instance_command = _MultiDecorator([])
|
||||||
project_command = _MultiDecorator([_project_arg])
|
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):
|
def user_query(description: str, default: Any, cast_to: Type[Any] = str):
|
||||||
|
|
Loading…
Reference in a new issue