mirror of
https://github.com/daylinmorgan/tsm.git
synced 2024-12-22 05:00:44 -06:00
Compare commits
2 commits
7a47942520
...
3aa9fb9490
Author | SHA1 | Date | |
---|---|---|---|
3aa9fb9490 | |||
0c03398f37 |
2 changed files with 25 additions and 13 deletions
33
src/tsm.nim
33
src/tsm.nim
|
@ -1,14 +1,9 @@
|
||||||
import std/sequtils
|
import std/[sequtils, os]
|
||||||
import ./[selector, project, tmuxutils]
|
import ./[selector, project, tmuxutils, term]
|
||||||
import hwylterm, hwylterm/hwylcli
|
import hwylterm, hwylterm/hwylcli
|
||||||
|
|
||||||
proc tsm(open: bool = false) =
|
proc tsm(project: Project) =
|
||||||
let
|
if project.name notin tmux.sessions.mapIt(it.name):
|
||||||
projects = findProjects(open)
|
|
||||||
project = selectProject projects
|
|
||||||
selected = project.name
|
|
||||||
|
|
||||||
if selected notin tmux.sessions.mapIt(it.name):
|
|
||||||
tmux.new(project.name, project.location)
|
tmux.new(project.name, project.location)
|
||||||
else:
|
else:
|
||||||
tmux.attach project.name
|
tmux.attach project.name
|
||||||
|
@ -20,7 +15,23 @@ hwylCli:
|
||||||
name "tsm"
|
name "tsm"
|
||||||
V tsmVersion
|
V tsmVersion
|
||||||
flags:
|
flags:
|
||||||
open "only search open sessions"
|
open:
|
||||||
|
? "only search open sessions"
|
||||||
|
- o
|
||||||
|
new:
|
||||||
|
? "open session in current directory"
|
||||||
|
- n
|
||||||
run:
|
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)
|
||||||
|
|
||||||
|
|
5
todo.md
5
todo.md
|
@ -1,7 +1,8 @@
|
||||||
# tsm todo's
|
# tsm todo's
|
||||||
|
|
||||||
- [x] add message about new keybind Ctrl+E
|
- [x] add message about new keybind Ctrl+E
|
||||||
- [-] add open session info as faint text -> "session: 2 windows (created ......)"
|
- [x] add open session info as faint text -> "session: 2 windows (created ......)"
|
||||||
- include this info for the configured but open sessions too
|
- [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 -->
|
<!-- generated with <3 by daylinmorgan/todo -->
|
||||||
|
|
Loading…
Reference in a new issue