Use named shell prompt for tmux containers

This commit is contained in:
mpabi
2026-05-11 23:35:30 +02:00
parent a426c54cab
commit bd25732428
+21 -2
View File
@@ -3376,8 +3376,11 @@ def build_container_command(
selector_slug = slug_value(selector.replace("/", "-"), "card selector") selector_slug = slug_value(selector.replace("/", "-"), "card selector")
window_slug = slug_value(window_name, "tmux window name") window_slug = slug_value(window_name, "tmux window name")
user_name = current_user_slug() user_name = current_user_slug()
host_uid = str(os.getuid())
host_gid = str(os.getgid())
container_name_parts = [selector_slug, window_slug, profile, user_name] container_name_parts = [selector_slug, window_slug, profile, user_name]
container_name = "-".join(container_name_parts) container_name = "-".join(container_name_parts)
shell_rcfile = tool_root / "configs" / "rv-shell.bashrc"
env_parts = [ env_parts = [
f"WORKSPACE_ROOT={shlex.quote(str(config.workspace_root))}", f"WORKSPACE_ROOT={shlex.quote(str(config.workspace_root))}",
f"RV_CARDS_ROOT={shlex.quote(str(config.series_root))}", f"RV_CARDS_ROOT={shlex.quote(str(config.series_root))}",
@@ -3387,6 +3390,9 @@ def build_container_command(
f"RV_REPO_HOST={shlex.quote(str(card_path))}", f"RV_REPO_HOST={shlex.quote(str(card_path))}",
f"RV_CARD={shlex.quote(selector)}", f"RV_CARD={shlex.quote(selector)}",
f"RV_INSTANCE={shlex.quote(instance)}", f"RV_INSTANCE={shlex.quote(instance)}",
f"RV_HOST_USER={shlex.quote(user_name)}",
f"RV_HOST_UID={host_uid}",
f"RV_HOST_GID={host_gid}",
"RV_CODEX=0", "RV_CODEX=0",
] ]
compose_args = [ compose_args = [
@@ -3405,6 +3411,16 @@ def build_container_command(
"-e", "-e",
f"HOME={home_dir}", f"HOME={home_dir}",
"-e", "-e",
f"USER={user_name}",
"-e",
f"LOGNAME={user_name}",
"-e",
f"RV_HOST_USER={user_name}",
"-e",
f"RV_HOST_UID={host_uid}",
"-e",
f"RV_HOST_GID={host_gid}",
"-e",
f"RV_REPO={card_path_text}", f"RV_REPO={card_path_text}",
"-e", "-e",
f"WORKSPACE_ROOT={config.workspace_root}", f"WORKSPACE_ROOT={config.workspace_root}",
@@ -3422,9 +3438,12 @@ def build_container_command(
"RV_CODEX=0", "RV_CODEX=0",
"-v", "-v",
f"{card_path_text}:{card_path_text}", f"{card_path_text}:{card_path_text}",
service,
"shell",
] ]
shell_args = [service, "shell"]
if shell_rcfile.is_file():
compose_args.extend(["-v", f"{shell_rcfile}:/tmp/rv-shell.bashrc:ro"])
shell_args.extend(["--rcfile", "/tmp/rv-shell.bashrc"])
compose_args.extend(shell_args)
return " && ".join( return " && ".join(
[ [
f"cd {shlex.quote(str(tool_root))}", f"cd {shlex.quote(str(tool_root))}",