diff --git a/spud/cli.py b/spud/cli.py index 829a8c4..1fba4ac 100644 --- a/spud/cli.py +++ b/spud/cli.py @@ -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']}")