mirror of
https://github.com/daylinmorgan/tsm.git
synced 2024-12-21 20:50:45 -06:00
fix: don't get session list if not running
This commit is contained in:
parent
f2ddcac75f
commit
947847459d
1 changed files with 6 additions and 4 deletions
|
@ -25,13 +25,15 @@ template cmd(tmux: Tmux, args: string) =
|
|||
|
||||
proc newTmux(): Tmux =
|
||||
result.active = existsEnv("TMUX")
|
||||
result.sessions = (
|
||||
result.cmdGet "list-sessions -F '#S'"
|
||||
).strip().split("\n")
|
||||
# check if server is active?
|
||||
if execCmd("tmux run") == 0:
|
||||
result.sessions = (
|
||||
result.cmdGet "list-sessions -F '#S'"
|
||||
).strip().split("\n")
|
||||
|
||||
proc attach*(t: Tmux, session: string) =
|
||||
let args =
|
||||
if t.active:"switch-client -t"
|
||||
if t.active: "switch-client -t"
|
||||
else: "attach -t"
|
||||
t.cmd fmt"{args} {session}"
|
||||
|
||||
|
|
Loading…
Reference in a new issue