diff --git a/nimble.lock b/nimble.lock index 43aae3e..e20d08a 100644 --- a/nimble.lock +++ b/nimble.lock @@ -3,12 +3,12 @@ "packages": { "hwylterm": { "version": "0.1.0", - "vcsRevision": "337083afe13bf0f1bd024b870c2174a901e8ce06", + "vcsRevision": "b6202f4f51edadd041d2b5f2aed1d75abcd4ee51", "url": "https://github.com/daylinmorgan/hwylterm", "downloadMethod": "git", "dependencies": [], "checksums": { - "sha1": "a995a81f5e4af2991c79ed04b02f17d47dd509e0" + "sha1": "eb38b434419ec70f080f79b7826c3c3989a2c74a" } }, "illwill": { diff --git a/src/tsm.nim b/src/tsm.nim index 815aad7..a237c7a 100644 --- a/src/tsm.nim +++ b/src/tsm.nim @@ -13,43 +13,43 @@ proc tsm(open: bool = false) = tmux.attach project.name -when isMainModule: - import std/parseopt - import hwylterm, hwylterm/cli +# when isMainModule: + # import std/parseopt +import hwylterm, hwylterm/hwylcli - const - tsmVersion {.strdefine.} = - staticExec "git describe --tags --always HEAD --match 'v*'" - usage = - """tmux session manager +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}" + [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 newHwylCliHelp(usage = 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 cmdError: assert false + of cmdEnd: assert false + 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) +tsm(open) diff --git a/tsm.nimble b/tsm.nimble index 8e946f9..368c198 100644 --- a/tsm.nimble +++ b/tsm.nimble @@ -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#b6202f4" requires "https://github.com/usu-dev/usu-nim"