From 7a479425201ab3d3ff6c268f9bfdefa25eb0b531 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 13 Dec 2024 12:03:12 -0600 Subject: [PATCH] add session info to open sessions --- src/project.nim | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/project.nim b/src/project.nim index 10414f2..95bb3fa 100644 --- a/src/project.nim +++ b/src/project.nim @@ -71,6 +71,15 @@ func projectFromSession(s: TmuxSession): Project = result.tmuxinfo = s.info +proc addInfo(project: var seq[Project]) = + ## naive fix to adding tmuxinfo until I rewrite findProjects + let sessions = collect: + for s in tmux.sessions: + {s.name: s} + for p in project.mitems: + if p.name in sessions: + p.tmuxinfo = sessions[p.name].info + proc findProjects*(open: bool = false): seq[Project] = let tsmConfig = loadTsmConfig() @@ -117,10 +126,11 @@ proc findProjects*(open: bool = false): seq[Project] = if sessions.len > 0: result = tmux.sessions.filterIt(it.name in sessions).mapIt(projectFromSession(it)) & result - # result = sessions.toSeq().mapIt(newUnknownProject(it)) & result if len(result) == 0: termError "nothing to select, check your [yellow]$TSM_PATHS" termEcho "searched these directories: " echo getTsmDirs().mapIt(" " & it).join("\n") quit QuitFailure + + addInfo result