Compare commits
3 commits
1032b97146
...
588d763930
Author | SHA1 | Date | |
---|---|---|---|
588d763930 | |||
cae07a51f4 | |||
f96d3af974 |
6 changed files with 29 additions and 29 deletions
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
makeWrapper,
|
|
||||||
buildNimblePackage,
|
buildNimblePackage,
|
||||||
}:
|
}:
|
||||||
buildNimblePackage {
|
buildNimblePackage {
|
||||||
|
@ -8,7 +7,6 @@ buildNimblePackage {
|
||||||
version = "unstable";
|
version = "unstable";
|
||||||
|
|
||||||
src = lib.cleanSource ./.;
|
src = lib.cleanSource ./.;
|
||||||
nativeBuildInputs = [ makeWrapper ];
|
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
nimbleDepsHash = "sha256-fw0Utdq5wu2t30hez6EWgulzieIMlE07bOpYdtL6nms=";
|
nimbleDepsHash = "sha256-2yuYtCq4nqwXlWA02RhoScfGprEVdZkxoaVSWPH0eL8=";
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
|
@ -10,6 +10,16 @@
|
||||||
"checksums": {
|
"checksums": {
|
||||||
"sha1": "5a082835594887c0fdaea17dbfd2d3a2e744a2a9"
|
"sha1": "5a082835594887c0fdaea17dbfd2d3a2e744a2a9"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"hwylterm": {
|
||||||
|
"version": "0.1.0",
|
||||||
|
"vcsRevision": "7e82f7ba5a24d816a79b3a5ea49f32b4c7a5ef7e",
|
||||||
|
"url": "https://github.com/daylinmorgan/hwylterm",
|
||||||
|
"downloadMethod": "git",
|
||||||
|
"dependencies": [],
|
||||||
|
"checksums": {
|
||||||
|
"sha1": "d6d97bdff3fcdfcf4b39b144fa5f27a6b9f9494d"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tasks": {}
|
"tasks": {}
|
||||||
|
|
5
tunnel-nim/todo.md
Normal file
5
tunnel-nim/todo.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# tunnel-nim todo's
|
||||||
|
|
||||||
|
- [ ] show no output from `tunnel up` on connection
|
||||||
|
|
||||||
|
<!-- generated with <3 by daylinmorgan/todo -->
|
|
@ -1,11 +1,12 @@
|
||||||
import std/[os, osproc, sequtils, strformat, strutils, sugar]
|
import std/[os, osproc, sequtils, strformat, strutils, sugar]
|
||||||
import cligen
|
import hwylterm
|
||||||
|
|
||||||
|
|
||||||
proc checkHost(host: seq[string]): string =
|
proc checkHost(host: seq[string]): string =
|
||||||
case host.len:
|
case host.len:
|
||||||
of 1: return host[0]
|
of 1: return host[0]
|
||||||
of 0: quit "expected hostname"
|
of 0: quit $bb"[red]expected hostname"
|
||||||
else: quit "expected one positinal argument"
|
else: quit $bb"[red]expected one positional argument"
|
||||||
|
|
||||||
proc check(name: string): bool = (execCmd &"ssh -O check {name}") == 0
|
proc check(name: string): bool = (execCmd &"ssh -O check {name}") == 0
|
||||||
proc startSsh(name: string) = discard execCmd &"ssh -M -f -N {name}"
|
proc startSsh(name: string) = discard execCmd &"ssh -M -f -N {name}"
|
||||||
|
@ -33,13 +34,15 @@ proc show() =
|
||||||
collect(for _,p in walkDir(sshDir): p)
|
collect(for _,p in walkDir(sshDir): p)
|
||||||
.map(extractFilename)
|
.map(extractFilename)
|
||||||
.filterIt(it.startsWith("control"))
|
.filterIt(it.startsWith("control"))
|
||||||
echo &"{controllers.len} active connections"
|
echo fmt"[yellow]{controllers.len}[/] active connections"
|
||||||
if controllers.len == 0: quit 0
|
if controllers.len == 0: quit 0
|
||||||
echo "hosts:"
|
echo "hosts:"
|
||||||
echo controllers.mapIt(" " & it.split('-')[1]).join("\n")
|
echo controllers.mapIt(" " & it.split('-')[1]).join("\n")
|
||||||
|
|
||||||
const
|
when isMainModule:
|
||||||
hostUsage = "$command [flags] hostname\n${doc}Options:\n$options"
|
import cligen, hwylterm/cligen
|
||||||
usage = "$command [flags]\n${doc}Options:\n$options"
|
hwylCli(clCfg)
|
||||||
|
let
|
||||||
dispatchMulti([up, usage=hostUsage], [down, usage=hostUsage], [show, usage=usage])
|
# 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])
|
||||||
|
|
|
@ -11,5 +11,5 @@ bin = @["tunnel"]
|
||||||
# Dependencies
|
# Dependencies
|
||||||
requires "nim >= 2.0.8"
|
requires "nim >= 2.0.8"
|
||||||
requires "cligen"
|
requires "cligen"
|
||||||
|
requires "https://github.com/daylinmorgan/hwylterm#HEAD"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue