Compare commits

...

2 commits

Author SHA1 Message Date
3aa9fb9490
add support for opening session in current directory 2024-12-18 16:02:04 -06:00
0c03398f37
todo 2024-12-13 12:10:35 -06:00
2 changed files with 25 additions and 13 deletions

View file

@ -1,14 +1,9 @@
import std/sequtils
import ./[selector, project, tmuxutils]
import std/[sequtils, os]
import ./[selector, project, tmuxutils, term]
import hwylterm, hwylterm/hwylcli
proc tsm(open: bool = false) =
let
projects = findProjects(open)
project = selectProject projects
selected = project.name
if selected notin tmux.sessions.mapIt(it.name):
proc tsm(project: Project) =
if project.name notin tmux.sessions.mapIt(it.name):
tmux.new(project.name, project.location)
else:
tmux.attach project.name
@ -20,7 +15,23 @@ hwylCli:
name "tsm"
V tsmVersion
flags:
open "only search open sessions"
open:
? "only search open sessions"
- o
new:
? "open session in current directory"
- n
run:
tsm(open)
if new and open:
termQuit "--new and --open are mutually exclusive"
let project =
if new: newProject(
path = getCurrentDir(),
open = false,
)
else:
selectProject findProjects(open)
tsm(project)

View file

@ -1,7 +1,8 @@
# tsm todo's
- [x] add message about new keybind Ctrl+E
- [-] add open session info as faint text -> "session: 2 windows (created ......)"
- include this info for the configured but open sessions too
- [x] add open session info as faint text -> "session: 2 windows (created ......)"
- [x] include this info for the configured but open sessions too
- [ ] add `-n,--new` flag to emulate `Ctrl+E` behavior
<!-- generated with <3 by daylinmorgan/todo -->