Skip to content

Commit 0718515

Browse files
committed
add binary to status
1 parent 6c18672 commit 0718515

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/warnet/status.py

+17
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def status():
1515

1616
tanks = _get_tank_status()
1717
scenarios = _get_active_scenarios()
18+
binaries = _get_active_binaries()
1819

1920
# Create a unified table
2021
table = Table(title="Warnet Status", show_header=True, header_style="bold magenta")
@@ -37,6 +38,17 @@ def status():
3738
else:
3839
table.add_row("Scenario", "No active scenarios", "")
3940

41+
# Add a separator if there are both tanks or scenarios and binaries
42+
if (tanks or scenarios) and binaries:
43+
table.add_row("", "", "")
44+
45+
# Add binaries to the table
46+
if binaries:
47+
for binary in binaries:
48+
table.add_row("Binary", binary["name"], binary["status"])
49+
else:
50+
table.add_row("Binaries", "No active binaries", "")
51+
4052
# Create a panel to wrap the table
4153
panel = Panel(
4254
table,
@@ -53,6 +65,7 @@ def status():
5365
summary = Text()
5466
summary.append(f"\nTotal Tanks: {len(tanks)}", style="bold cyan")
5567
summary.append(f" | Active Scenarios: {len(scenarios)}", style="bold green")
68+
summary.append(f" | Active Binaries: {len(binaries)}", style="bold red")
5669
console.print(summary)
5770
_connected(end="\r")
5871

@@ -65,3 +78,7 @@ def _get_tank_status():
6578
def _get_active_scenarios():
6679
commanders = get_mission("commander")
6780
return [{"name": c.metadata.name, "status": c.status.phase.lower()} for c in commanders]
81+
82+
def _get_active_binaries():
83+
binaries = get_mission("binary")
84+
return [{"name": b.metadata.name, "status": b.status.phase.lower()} for b in binaries]

0 commit comments

Comments
 (0)