add more convience combiner procs

This commit is contained in:
Daylin Morgan 2024-09-28 18:02:04 -05:00
parent b3d07dcc84
commit 57e99e8f27
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 17 additions and 14 deletions

View file

@ -6,5 +6,3 @@ task build, "build oizys":
when withDir(thisDir(), system.fileExists("nimble.paths")): when withDir(thisDir(), system.fileExists("nimble.paths")):
include "nimble.paths" include "nimble.paths"
# end Nimble config # end Nimble config
#
--path:"../../../dev/github/daylinmorgan/hwylterm/src"

View file

@ -86,10 +86,15 @@ proc checkExes() =
if findExe("nix") == "": if findExe("nix") == "":
fatalQuit "oizys requires nix" fatalQuit "oizys requires nix"
proc `//`(t1: Table[string, string], t2: Table[string, string]): Table[string, string] = func `//`[A, B](pairs: openArray[(A, B)]): Table[A, B] =
# nix style shallow table merge pairs.toTable()
for k, v in t1.pairs(): result[k] = v func `//`[A, B](t1: var Table[A,B], t2: Table[A,B]) =
for k, v in t2.pairs(): result[k] = v for k, v in t2.pairs(): t1[k] = v
func `//`[A, B](t1: Table[A, B], t2: Table[A, B]): Table[A, B] =
result // t1; result // t2
func `//`[A, B](pairs: openArray[(A,B)], t2: Table[A,B]): Table[A,B] =
// pairs // t2
when isMainModule: when isMainModule:
@ -98,21 +103,21 @@ when isMainModule:
hwylCli(clCfg) hwylCli(clCfg)
const const
sharedHelp = { sharedHelp = //{
"flake" : "path/to/flake", "flake" : "path/to/flake",
"host" : "host(s) to build", "host" : "host(s) to build",
"debug" : "enable debug mode", "debug" : "enable debug mode",
"resetCache" : "set cache timeout to 0" "resetCache" : "set cache timeout to 0"
}.toTable() }
updateHelp = { updateHelp = //{
"yes" : "skip all confirmation prompts" "yes" : "skip all confirmation prompts"
}.toTable() // sharedHelp } // sharedHelp
ciHelp = { ciHelp = //{
"ref" : "git ref/branch/tag to trigger workflow on" "ref" : "git ref/branch/tag to trigger workflow on"
}.toTable() }
cacheHelp = { cacheHelp = //{
"name" : "name of cachix binary cache" "name" : "name of cachix binary cache"
}.toTable() // sharedHelp } // sharedHelp
let let
# clUse must be set here using clCfg doesn't seem to work with dispatchMutli ... # clUse must be set here using clCfg doesn't seem to work with dispatchMutli ...
clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options") clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options")