kiwi-scp/kiwi_scp/commands/cmd_list.py

21 lines
530 B
Python
Raw Normal View History

from typing import Tuple
2021-10-21 02:02:38 +00:00
import click
2021-10-28 13:53:32 +00:00
from ..instance import Instance, pass_instance
from ..misc import service_command
2021-10-21 02:02:38 +00:00
2021-10-22 15:52:46 +00:00
@click.command(
"list",
short_help="Inspect a kiwi-scp instance",
)
2021-10-28 13:53:32 +00:00
@pass_instance
2021-10-21 02:02:38 +00:00
@service_command
def cmd(ctx: Instance, project: str, services: Tuple[str]):
2021-10-22 15:52:46 +00:00
"""List projects in this instance, services inside a project or service(s) inside a project"""
2021-10-28 13:53:32 +00:00
if project is not None:
print(ctx.get_services(project, services))
2021-10-28 13:53:32 +00:00
else:
print(f"projects: {ctx.config.projects}")