feat(client): add success, error, no-op messaging
All checks were successful
/ Tests (push) Successful in 56s
/ Static Analysis (push) Successful in 1m13s

This commit is contained in:
Marc 2024-04-27 11:48:36 -04:00
parent 17781b0eb9
commit e3eba874a2
Signed by: marc
GPG key ID: 048E042F22B5DC79

View file

@ -80,11 +80,26 @@ def print_config(context):
@click.command()
@click.pass_context
def status(context):
response = context.obj["api_client"].get("/status")
data = response.json()
"""
Reports on the status of running services in a tree-like format.
"""
try:
response = context.obj["api_client"].get("/status")
data = response.json()
except Exception as exc: # pylint: disable=broad-exception-caught
click.secho(f"Failed to get services statuses: {str(exc)}", bold=True, fg="red")
return
if not data:
click.secho("No running services to report on.", bold=True, fg="yellow")
return
for service in data:
click.echo(f"{service['name']}: {service['status']}")
click.echo(
click.style(f"{service['name']}", bold=True, fg="green")
+ f": {service['status']}"
)
for container in service["containers"]:
click.echo(f" + {container['name']} - {container['status']}")