office --host with the host table and self-check; board --reset; startup commands written down

This commit is contained in:
Sam
2026-11-12 11:33:47 +11:00
parent e02b04196f
commit 7b2cccf2ff
4 changed files with 142 additions and 4 deletions

View File

@@ -16,6 +16,8 @@ renumbers the rest. Run it twice and nothing is duplicated.
import os
import shlex
import subprocess
import time
import sys
HERE = os.path.dirname(os.path.abspath(__file__))
@@ -28,7 +30,8 @@ BIN = os.path.join(os.path.dirname(HERE), "bin", "harness")
def parse(argv):
opts = {"folder": os.getcwd(), "replace": "--replace" in argv}
opts = {"folder": os.getcwd(), "replace": "--replace" in argv,
"reset": "--reset" in argv}
for i, a in enumerate(argv):
if a == "--folder" and i + 1 < len(argv):
opts["folder"] = argv[i + 1]
@@ -76,6 +79,22 @@ def main():
h.say("board: %s (session %s, folder %s)" % (cfg["paperclip"]["project"], session, folder))
h.say("watching: %s" % task)
if opts["reset"]:
# Empty the session first, then build. --replace alone can run out of
# workspace slots on a half-built session and leave pages missing.
h.say("reset: closing every pane in %s" % session)
for w in tuios.windows(session):
subprocess.run(["tuios", "close-window", w["window_id"], "-s", session],
capture_output=True, text=True, timeout=30)
for _ in range(30):
if not tuios.windows(session):
break
time.sleep(0.5)
for w in tuios.workspaces(session):
subprocess.run(["tuios", "set-workspace-name", str(w["workspace"]), "",
"-s", session], capture_output=True, text=True, timeout=20)
h.say("reset: %s" % ("empty" if not tuios.windows(session) else "panes remain, building anyway"))
if opts["replace"]:
for name, _, _ in page_list:
if tuios.close_pane(name, session):