feat: add back open flag support

This commit is contained in:
Daylin Morgan 2023-09-29 14:07:41 -05:00
parent 947847459d
commit 81f7e0b4a8
Signed by: daylin
GPG key ID: C1E52E7DD81DF79F
3 changed files with 6 additions and 5 deletions

View file

@ -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

View file

@ -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:

View file

@ -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()