2023-09-21 13:43:14 -05:00
|
|
|
import std/[tables]
|
2023-09-05 13:36:33 -05:00
|
|
|
|
2023-10-03 13:06:34 -05:00
|
|
|
import selector, project, tmuxutils
|
2023-09-05 17:02:08 -05:00
|
|
|
|
2023-09-29 14:07:41 -05:00
|
|
|
proc tsm(open: bool = false) =
|
2023-09-05 13:36:33 -05:00
|
|
|
let
|
2023-09-29 14:07:41 -05:00
|
|
|
project = selectProject(open)
|
2023-09-05 13:36:33 -05:00
|
|
|
selected = project.name
|
|
|
|
|
2023-09-21 13:43:14 -05:00
|
|
|
if selected notin tmux.sessions:
|
|
|
|
tmux.new project.name, project.location
|
2023-09-05 13:36:33 -05:00
|
|
|
else:
|
2023-09-21 13:43:14 -05:00
|
|
|
tmux.attach project.name
|
2023-09-05 13:36:33 -05:00
|
|
|
|
|
|
|
when isMainModule:
|
|
|
|
import cligen
|
2023-09-21 13:43:14 -05:00
|
|
|
const vsn = staticExec "git describe --tags --always HEAD --match 'v*'"
|
2023-09-05 13:36:33 -05:00
|
|
|
clCfg.version = vsn
|
|
|
|
|
|
|
|
if clCfg.helpAttr.len == 0:
|
|
|
|
clCfg.helpAttr = {"cmd": "\e[1;36m", "clDescrip": "", "clDflVal": "\e[33m",
|
|
|
|
"clOptKeys": "\e[32m", "clValType": "\e[31m", "args": "\e[3m"}.toTable
|
|
|
|
clCfg.helpAttrOff = {"cmd": "\e[m", "clDescrip": "\e[m", "clDflVal": "\e[m",
|
|
|
|
"clOptKeys": "\e[m", "clValType": "\e[m", "args": "\e[m"}.toTable
|
|
|
|
|
|
|
|
dispatch(
|
|
|
|
tsm,
|
|
|
|
short = {"version": 'v'},
|
|
|
|
)
|