Skip to content

Commit

Permalink
Merge pull request #2 from dtdang/fix/cluster_info
Browse files Browse the repository at this point in the history
fix: mypy
  • Loading branch information
dtdang authored Nov 1, 2024
2 parents dc57c9d + a218fc9 commit 0269dbb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions silverback/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,10 +322,13 @@ def list_clusters(platform: PlatformClient, workspace: str):
if not (workspace_client := platform.workspaces.get(workspace)):
raise click.BadOptionUsage("workspace", f"Unknown workspace '{workspace}'")

if cluster_names := list(workspace_client.clusters):
for name in cluster_names:
cluster = workspace_client.clusters.get(name)
click.echo(f"- {name} ({cluster.status})")
if cluster_names := workspace_client.clusters:
cluster_info = [
f"- {name} ({cluster.status})"
for name in cluster_names
if (cluster := workspace_client.clusters.get(name)) is not None
]
click.echo("\n".join(cluster_info))

else:
click.secho("No clusters for this account", bold=True, fg="red")
Expand Down

0 comments on commit 0269dbb

Please sign in to comment.