fix(tuios): create sessions with cwd before attaching (#418)

This commit is contained in:
ryan4yin | 二花 authored and GitHub committed 2026-10-08 20:50:28 +08:00
1 parent 48ac4f76bf
commit 4a27852fd1
1 file changed
+9 -2
+9 -2
View File
@@ -24,11 +24,18 @@ in
programs.nushell.extraConfig = ''
# auto start tuios
if $nu.is-interactive and (not ("TUIOS_SESSION" in $env)) {
let sessions = (^tuios ls --json | from json | get name)
let work_root = ($nu.home-dir | path join "work")
if $env.PWD == $work_root or ($env.PWD | str starts-with $"($work_root)/") {
^tuios attach work -c --cwd $work_root
if "work" not-in $sessions {
^tuios new work --detach --cwd $work_root
}
^tuios attach work
} else {
^tuios attach personal -c --cwd $nu.home-dir
if "personal" not-in $sessions {
^tuios new personal --detach --cwd $nu.home-dir
}
^tuios attach personal
}
}
'';