Compare commits

...

4 commits

Author SHA1 Message Date
4b53d3e050
update to hwylcli 2024-11-12 15:25:54 -06:00
90e4139284
simpler config.nims 2024-11-08 14:13:57 -06:00
0098a70de1
nix/flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/280db3decab4cbeb22a4599bd472229ab74d25e1' (2024-09-12)
  → 'github:nixos/nixpkgs/85f7e662eda4fa3a995556527c87b2524b691933' (2024-11-07)
2024-11-08 09:45:29 -06:00
eeb6bca377
chore: upgrade hwylterm 2024-11-08 09:44:46 -06:00
5 changed files with 17 additions and 54 deletions

View file

@ -2,13 +2,9 @@ import std/[strformat, strutils]
task debugSelect, "debug select":
exec "nim -d:debugSelect c -r src/selector.nim"
task build, "build app":
selfExec "c -o:bin/tsm src/tsm.nim"
task buildRelease, "build release app":
selfExec "c -d:release -o:bin/tsm src/tsm.nim"
--define:"debugSelect"
--run
setCommand("c", "src/selector.nim")
task release, "build release assets w/forge":
version = (gorgeEx "git describe --tags --always --match 'v*'").output

View file

@ -3,12 +3,12 @@
"packages": {
"hwylterm": {
"version": "0.1.0",
"vcsRevision": "337083afe13bf0f1bd024b870c2174a901e8ce06",
"vcsRevision": "2a5dce888d7abf5409a62208d951ac3a4e6babfa",
"url": "https://github.com/daylinmorgan/hwylterm",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "a995a81f5e4af2991c79ed04b02f17d47dd509e0"
"sha1": "56afeceb88973f730111cfa7d02aef2d0cf88197"
}
},
"illwill": {

View file

@ -36,11 +36,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1726142289,
"narHash": "sha256-Jks8O42La+nm5AMTSq/PvM5O+fUAhIy0Ce1QYqLkyZ4=",
"lastModified": 1730958623,
"narHash": "sha256-JwQZIGSYnRNOgDDoIgqKITrPVil+RMWHsZH1eE1VGN0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "280db3decab4cbeb22a4599bd472229ab74d25e1",
"rev": "85f7e662eda4fa3a995556527c87b2524b691933",
"type": "github"
},
"original": {

View file

@ -1,6 +1,6 @@
import ./[selector, project, tmuxutils]
import hwylterm, hwylterm/hwylcli
# TODO: add option to only opened configured sessions
proc tsm(open: bool = false) =
let
projects = findProjects(open)
@ -12,44 +12,11 @@ proc tsm(open: bool = false) =
else:
tmux.attach project.name
hwylCli:
name "tsm"
V tsmVersion
flags:
open "only search open sessions"
run:
tsm(open)
when isMainModule:
import std/parseopt
import hwylterm, hwylterm/cli
const
tsmVersion {.strdefine.} =
staticExec "git describe --tags --always HEAD --match 'v*'"
usage =
"""tmux session manager
[bold]tsm[/] [[[faint]-h|-v|-o[/]]"""
flags = [
("h","help","show this help"),
("v","version", "print version"),
("o","open", "only search open sessions")
]
proc help() = echo newHwylCli(usage, flags = flags)
var open: bool
var p = initOptParser(
shortNoVal = {'h', 'v', 'o'},
longNoVal = @["open"]
)
for kind, key, val in p.getOpt():
case kind:
of cmdEnd:
break
of cmdArgument:
echo bb"[red]Error[/]: unexpected positional argument ", bbfmt"[bold]{key}[/]"
of cmdShortOption, cmdLongOption:
case key:
of "help", "h":
help(); quit 0
of "version", "v":
echo "tsm: " & tsmVersion; quit 0
of "open", "o":
open = true
else:
echo bbfmt"[red]Error[/]: unknown key value pair", bbfmt"[b]key[/]: {key}, [b]value[/]: {val}"
tsm(open)

View file

@ -12,6 +12,6 @@ binDir = "bin"
requires "nim >= 2.0.0"
requires "illwill >= 0.4.1"
requires "https://github.com/daylinmorgan/hwylterm#HEAD"
requires "https://github.com/daylinmorgan/hwylterm#2a5dce88"
requires "https://github.com/usu-dev/usu-nim"