Skip to content

Commit

Permalink
feat: filter out log output on operation list
Browse files Browse the repository at this point in the history
When browsing trhough a deployment, it is not useful to display the
first few words of each operation logs.
  • Loading branch information
PaulFarault committed Nov 2, 2023
1 parent f4bf96c commit bd96c6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tdp/cli/commands/browse.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _print_deployment(deployment: DeploymentLog) -> None:
click.echo("Deployment does not exist.")
return

print_deployment(deployment)
print_deployment(deployment, filter_out=["logs"])


def _print_operations(operations: list[OperationLog]) -> None:
Expand Down
10 changes: 6 additions & 4 deletions tdp/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
from collections.abc import Callable
from pathlib import Path
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Optional

import click
from click.decorators import FC
Expand Down Expand Up @@ -133,15 +133,17 @@ def preview(func: FC) -> FC:
)(func)


def print_deployment(deployment: DeploymentLog) -> None:
def print_deployment(
deployment: DeploymentLog, /, *, filter_out: Optional[list[str]] = None
) -> None:
# Print general deployment infos
click.secho("Deployment details", bold=True)
click.echo(print_object(deployment.to_dict()))
click.echo(print_object(deployment.to_dict(filter_out=filter_out)))

# Print deployment operations
click.secho("\nOperations", bold=True)
print_table(
[o.to_dict() for o in deployment.operations],
[o.to_dict(filter_out=filter_out) for o in deployment.operations],
)


Expand Down

0 comments on commit bd96c6e

Please sign in to comment.