ps command: show state and image only with --verbose flag

This commit is contained in:
2024-05-27 13:26:10 +02:00
parent fe3daa500f
commit 6e57713abd

View File

@ -1197,7 +1197,8 @@ def purge_volumes(apps: List[str]) -> None:
@cli.command()
@click.option('-a', '--apps', multiple=True)
@click.option('-w', '--watch', is_flag=True)
def ps(apps: List[str], watch: bool) -> None:
@click.option('-v', '--verbose', is_flag=True)
def ps(apps: List[str], watch: bool, verbose: bool) -> None:
"""
Check the health status of all apps inside the selected group.
@ -1216,7 +1217,11 @@ def ps(apps: List[str], watch: bool) -> None:
status = container['status']
if re.match(".*(starting|unknown|unhealthy).*", container['status']):
status = f'\033[31;1;4m{status}\033[0m'
rows.append([domain, container['service name'], status, container['state'], container['image']])
row = [domain, container['service name'], status]
if verbose:
row.append(container['state'])
row.append(container['image'])
rows.append(row)
if watch:
os.system('cls' if os.name == 'nt' else 'clear')
print(tabulate(rows, 'firstrow', 'rounded_outline'), flush=True)