Skip to content

Commit eaf2dce

Browse files
committed
Honor explicit TurtleTerm CLI identity override
1 parent d843913 commit eaf2dce

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

assets/sourceos/bin/sourceos-term

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,21 @@ EVENT_SCHEMA = "sourceos.terminal.event.v0"
3131
RECEIPT_SCHEMA = "sourceos.terminal.receipt.v0"
3232

3333

34+
def env(name: str, fallback: str = "") -> str:
35+
value = os.environ.get(name)
36+
if value is None or value == "":
37+
return fallback
38+
return value
39+
40+
3441
def invoked_name() -> str:
3542
return Path(sys.argv[0]).name or "turtle-term"
3643

3744

3845
def product_name() -> str:
46+
explicit = env("SOURCEOS_TERMINAL_CLI")
47+
if explicit in {"turtle-term", "sourceos-term"}:
48+
return explicit
3949
name = invoked_name()
4050
if name == "sourceos-term":
4151
return "sourceos-term"
@@ -56,13 +66,6 @@ def new_id(prefix: str) -> str:
5666
return f"{prefix}_{uuid.uuid4().hex}"
5767

5868

59-
def env(name: str, fallback: str = "") -> str:
60-
value = os.environ.get(name)
61-
if value is None or value == "":
62-
return fallback
63-
return value
64-
65-
6669
def xdg_runtime_dir() -> Path:
6770
return Path(env("XDG_RUNTIME_DIR", f"/tmp/sourceos-runtime-{os.getuid()}"))
6871

0 commit comments

Comments
 (0)