Compare commits

...

3 commits

Author SHA1 Message Date
588d763930
add hwylterm 2024-10-08 12:15:59 -05:00
cae07a51f4
add todos 2024-10-01 13:32:57 -05:00
f96d3af974
remove all lock.json 2024-10-01 13:32:23 -05:00
6 changed files with 29 additions and 29 deletions

View file

@ -1,6 +1,5 @@
{
lib,
makeWrapper,
buildNimblePackage,
}:
buildNimblePackage {
@ -8,7 +7,6 @@ buildNimblePackage {
version = "unstable";
src = lib.cleanSource ./.;
nativeBuildInputs = [ makeWrapper ];
doCheck = false;
nimbleDepsHash = "sha256-fw0Utdq5wu2t30hez6EWgulzieIMlE07bOpYdtL6nms=";
nimbleDepsHash = "sha256-2yuYtCq4nqwXlWA02RhoScfGprEVdZkxoaVSWPH0eL8=";
}

View file

@ -1,16 +0,0 @@
{
"depends": [
{
"method": "fetchzip",
"path": "/nix/store/5a5aafd2vb3yb39ha5hbz8im9al9shjg-source",
"rev": "0e7b3b3a1fa77c448d3681c5fdf85197844cb7e4",
"sha256": "1c5xdxmgvibbrkn53svawp3wbwb0ylg3fnzbpgiadgnnpz3cdixz",
"srcDir": "",
"url": "https://github.com/c-blake/cligen/archive/0e7b3b3a1fa77c448d3681c5fdf85197844cb7e4.tar.gz",
"subDir": "",
"packages": [
"cligen"
]
}
]
}

View file

@ -10,6 +10,16 @@
"checksums": {
"sha1": "5a082835594887c0fdaea17dbfd2d3a2e744a2a9"
}
},
"hwylterm": {
"version": "0.1.0",
"vcsRevision": "7e82f7ba5a24d816a79b3a5ea49f32b4c7a5ef7e",
"url": "https://github.com/daylinmorgan/hwylterm",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "d6d97bdff3fcdfcf4b39b144fa5f27a6b9f9494d"
}
}
},
"tasks": {}

5
tunnel-nim/todo.md Normal file
View file

@ -0,0 +1,5 @@
# tunnel-nim todo's
- [ ] show no output from `tunnel up` on connection
<!-- generated with <3 by daylinmorgan/todo -->

View file

@ -1,11 +1,12 @@
import std/[os, osproc, sequtils, strformat, strutils, sugar]
import cligen
import hwylterm
proc checkHost(host: seq[string]): string =
case host.len:
of 1: return host[0]
of 0: quit "expected hostname"
else: quit "expected one positinal argument"
of 0: quit $bb"[red]expected hostname"
else: quit $bb"[red]expected one positional argument"
proc check(name: string): bool = (execCmd &"ssh -O check {name}") == 0
proc startSsh(name: string) = discard execCmd &"ssh -M -f -N {name}"
@ -33,13 +34,15 @@ proc show() =
collect(for _,p in walkDir(sshDir): p)
.map(extractFilename)
.filterIt(it.startsWith("control"))
echo &"{controllers.len} active connections"
echo fmt"[yellow]{controllers.len}[/] active connections"
if controllers.len == 0: quit 0
echo "hosts:"
echo controllers.mapIt(" " & it.split('-')[1]).join("\n")
const
hostUsage = "$command [flags] hostname\n${doc}Options:\n$options"
usage = "$command [flags]\n${doc}Options:\n$options"
dispatchMulti([up, usage=hostUsage], [down, usage=hostUsage], [show, usage=usage])
when isMainModule:
import cligen, hwylterm/cligen
hwylCli(clCfg)
let
# use= $bb("$command [[[i]flags[/]]\n${doc}[b]Options[/]:\n$options")
hostUse= $bb("$command [green]hostname[/] [[[i]flags[/]]\n${doc}[b]Options[/]:\n$options")
dispatchMulti([up,usage=hostUse], [down, usage=hostUse], [show, usage=clCfg.use])

View file

@ -11,5 +11,5 @@ bin = @["tunnel"]
# Dependencies
requires "nim >= 2.0.8"
requires "cligen"
requires "https://github.com/daylinmorgan/hwylterm#HEAD"