From 0ab7f1fd626ffe08c3e4a1b089b02120c7e63a9e Mon Sep 17 00:00:00 2001 From: jpk Date: Mon, 16 Jan 2023 14:45:59 +0100 Subject: [PATCH] Show service stats (ps + top) --- doxy/cli.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/doxy/cli.py b/doxy/cli.py index 0d74993..ac91c03 100644 --- a/doxy/cli.py +++ b/doxy/cli.py @@ -98,7 +98,25 @@ def update(ctx, service, remove): services.docker_compose_command(command, compose_file) +@click.command(help="show service status (ps, top)") +@click.argument("service", nargs=1, shell_complete=complete_service_name) +@click.pass_context +@services.only_if_service_exists +def status(ctx, service): + compose_file = services.get_compose_file( + Path(ctx.obj["CONFIG"].root_directory) / service + ) + print(Rule(f"Status of {service}")) + command_chain = [ + ["ps"], + ["top"], + ] + for command in command_chain: + services.docker_compose_command(command, compose_file) + + main.add_command(list) main.add_command(edit) main.add_command(control) main.add_command(update) +main.add_command(status)