fix: sequential menu numbers

This commit is contained in:
admin 2026-08-03 15:37:04 +00:00
parent 1748371b34
commit 95e66f21c8

View file

@ -139,25 +139,24 @@ def main():
while True: while True:
undeployed = [k for k in cfg if k not in deployed] undeployed = [k for k in cfg if k not in deployed]
print("─── Menu ───") opts = []
if undeployed: if undeployed: opts.append(("Deploy pending", '1'))
print(f" Pending: {', '.join(undeployed)}") opts.append(("Add a new node", '2'))
print(" [1] Deploy all pending") if deployed: opts.append(("Show status", '3'))
else: if deployed: opts.append(("Remove a node", '4'))
print(" No nodes pending deployment.") opts.append(("Remote tunnel", '5'))
print(" [2] Add a new node") opts.append(("Quit", 'q'))
if deployed:
print(" [3] Show status") print("\n─── Menu ───")
print(" [4] Remove a node") if undeployed: print(f" Pending: {', '.join(undeployed)}")
print(" [5] Remote tunnel") for label, key in opts:
print(" [q] Quit") print(f" [{key}] {label}")
c = input("\nChoice: ").strip() c = input("\nChoice: ").strip()
if c == "1" and undeployed: if c == "1" and undeployed:
for name in undeployed: for name in undeployed:
nc = cfg[name] nc = cfg[name]
print(f"\nDeploying {name}...")
deploy_container(name, nc["token"], nc.get("cloud","EU"), deploy_container(name, nc["token"], nc.get("cloud","EU"),
str(nc.get("port","8081")), nc.get("upstream_ip",""), str(nc.get("port","8081")), nc.get("upstream_ip",""),
str(nc.get("upstream_port","80")), "", str(nc.get("upstream_port","80")), "",