From 81f7e0b4a8c38c37484c55f853707831c0e9e951 Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Fri, 29 Sep 2023 14:07:41 -0500 Subject: [PATCH] feat: add back open flag support --- src/project.nim | 3 ++- src/tsm.nim | 4 ++-- src/tui.nim | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/project.nim b/src/project.nim index 7675048..08b6d81 100644 --- a/src/project.nim +++ b/src/project.nim @@ -30,7 +30,8 @@ proc findProjects*(open: bool = false): seq[Project] = for devDir in tsmDirs.split(":"): for d in walkDir(devDir): let p = newProject(d.path, tmux.sessions) - if open and p.open: result.add p + if open: + if p.open: result.add p else: result.add p diff --git a/src/tsm.nim b/src/tsm.nim index 999ef29..fbce349 100644 --- a/src/tsm.nim +++ b/src/tsm.nim @@ -2,9 +2,9 @@ import std/[tables] import tui, project, utils -proc tsm() = +proc tsm(open: bool = false) = let - project = selectProject() + project = selectProject(open) selected = project.name if selected notin tmux.sessions: diff --git a/src/tui.nim b/src/tui.nim index 347132b..acaf596 100644 --- a/src/tui.nim +++ b/src/tui.nim @@ -42,7 +42,6 @@ type # TODO: don't need top level projects # let (_, projects) = findProjects() var state = State() -state.projects = findProjects() proc values(c: Coord): (int, int, int, int) = (c.x1, c.x2, c.y1, c.y2) @@ -219,8 +218,9 @@ proc newWindow(): Window = state.cursor.update(min = result.coord.y1+3, max = result.coord.y2-1) result.tooSmall = (result.width < 15 or result.height < 10) -proc selectProject*(): Project = +proc selectProject*(open: bool = false): Project = + state.projects = findProjects(open) illwillInit(fullscreen = true) setControlCHook(quitProc) hideCursor()