Skip to content

Commit

Permalink
Tweak if/else logic in kubectl-ng get (#490)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtomlinson authored Sep 11, 2024
1 parent 82cc942 commit c0099b9
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions examples/kubectl-ng/kubectl_ng/_get.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,16 @@ async def get(
kubernetes.namespace = kr8s.ALL

data = await get_resources(resources, label_selector, field_selector)
for kind, response in data.items():
table = await draw_table(kind, response, resource_names)

if not watch:
console.print(table)
for kind, response in data.items():
table = await draw_table(kind, response, resource_names)
if table:
console.print(table)
else:
kind = list(data)[0]
response = data[kind]
table = await draw_table(kind, response, resource_names)
with Live(table, console=console, auto_refresh=False) as live:
while True:
await anyio.sleep(5)
Expand Down

0 comments on commit c0099b9

Please sign in to comment.