Compare commits
No commits in common. "588d7639308ac41a5af29f84acd2d0c73d38501c" and "1032b97146ff7ef74df06e5e3babdde244c08280" have entirely different histories.
588d763930
...
1032b97146
6 changed files with 29 additions and 29 deletions
|
@ -1,5 +1,6 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
|
makeWrapper,
|
||||||
buildNimblePackage,
|
buildNimblePackage,
|
||||||
}:
|
}:
|
||||||
buildNimblePackage {
|
buildNimblePackage {
|
||||||
|
@ -7,6 +8,7 @@ buildNimblePackage {
|
||||||
version = "unstable";
|
version = "unstable";
|
||||||
|
|
||||||
src = lib.cleanSource ./.;
|
src = lib.cleanSource ./.;
|
||||||
|
nativeBuildInputs = [ makeWrapper ];
|
||||||
doCheck = false;
|
doCheck = false;
|
||||||
nimbleDepsHash = "sha256-2yuYtCq4nqwXlWA02RhoScfGprEVdZkxoaVSWPH0eL8=";
|
nimbleDepsHash = "sha256-fw0Utdq5wu2t30hez6EWgulzieIMlE07bOpYdtL6nms=";
|
||||||
}
|
}
|
||||||
|
|
16
tunnel-nim/lock.json
Normal file
16
tunnel-nim/lock.json
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"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,16 +10,6 @@
|
||||||
"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": {}
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# tunnel-nim todo's
|
|
||||||
|
|
||||||
- [ ] show no output from `tunnel up` on connection
|
|
||||||
|
|
||||||
<!-- generated with <3 by daylinmorgan/todo -->
|
|
|
@ -1,12 +1,11 @@
|
||||||
import std/[os, osproc, sequtils, strformat, strutils, sugar]
|
import std/[os, osproc, sequtils, strformat, strutils, sugar]
|
||||||
import hwylterm
|
import cligen
|
||||||
|
|
||||||
|
|
||||||
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 $bb"[red]expected hostname"
|
of 0: quit "expected hostname"
|
||||||
else: quit $bb"[red]expected one positional argument"
|
else: quit "expected one positinal 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}"
|
||||||
|
@ -34,15 +33,13 @@ 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 fmt"[yellow]{controllers.len}[/] active connections"
|
echo &"{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")
|
||||||
|
|
||||||
when isMainModule:
|
const
|
||||||
import cligen, hwylterm/cligen
|
hostUsage = "$command [flags] hostname\n${doc}Options:\n$options"
|
||||||
hwylCli(clCfg)
|
usage = "$command [flags]\n${doc}Options:\n$options"
|
||||||
let
|
|
||||||
# use= $bb("$command [[[i]flags[/]]\n${doc}[b]Options[/]:\n$options")
|
dispatchMulti([up, usage=hostUsage], [down, usage=hostUsage], [show, usage=usage])
|
||||||
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