update to newer hwylterm

This commit is contained in:
Daylin Morgan 2024-11-06 23:53:41 -06:00
parent 19df564645
commit b77b2489cc
Signed by: daylin
GPG key ID: 950D13E9719334AD
3 changed files with 114 additions and 48 deletions

View file

@ -8,7 +8,4 @@ binDir = "bin"
requires "nim >= 2.0.0" requires "nim >= 2.0.0"
requires "cligen" requires "https://github.com/daylinmorgan/hwylterm#dfd9a7d"
requires "https://github.com/daylinmorgan/hwylterm#HEAD"

View file

@ -1,24 +1,14 @@
{ {
"version": 2, "version": 2,
"packages": { "packages": {
"cligen": {
"version": "1.7.5",
"vcsRevision": "85daafd76b0104387f50ff3f75c829b4c2804412",
"url": "https://github.com/c-blake/cligen.git",
"downloadMethod": "git",
"dependencies": [],
"checksums": {
"sha1": "f3ffe7329c8db755677d3ca377d02ff176cec8b1"
}
},
"hwylterm": { "hwylterm": {
"version": "0.1.0", "version": "0.1.0",
"vcsRevision": "c2bcfd1f73dda97bd3e209c89e2abfe588f0977c", "vcsRevision": "dfd9a7d98d345510c9d248670b7e80f7501d1a5a",
"url": "https://github.com/daylinmorgan/hwylterm", "url": "https://github.com/daylinmorgan/hwylterm",
"downloadMethod": "git", "downloadMethod": "git",
"dependencies": [], "dependencies": [],
"checksums": { "checksums": {
"sha1": "1932229840c893c39acca0b50def19913678f5f0" "sha1": "7ed514f09d1f74f725c866ddb3cfba19cc8b3e42"
} }
} }
}, },

View file

@ -20,6 +20,7 @@ proc genFlags(target: string, args: seq[string] = @[]): seq[string] =
proc targets() = proc targets() =
## show available targets ## show available targets
zigExists()
let targetList = zigTargets() let targetList = zigTargets()
termEcho "[bold green]available targets:".bb termEcho "[bold green]available targets:".bb
stderr.writeLine targetList.columns stderr.writeLine targetList.columns
@ -118,39 +119,117 @@ proc release(
termErrQuit &"exited with code {errCode} see above for error" termErrQuit &"exited with code {errCode} see above for error"
when isMainModule: when isMainModule:
import cligen # import cligen
import hwylterm/cli # TODO: swap for hwylterm/hwylcli
hwylCli(clCfg) import hwylterm/hwylcli
# hwylCli(clCfg)
let clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options") # let clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options")
const vsn = staticExec "git describe --tags --always HEAD" const vsn = staticExec "git describe --tags --always HEAD"
var vsnCfg = clCfg hwylCli:
vsnCfg.version = vsn name "forge"
V vsn
subcommands:
--- targets
... "show available targets"
run: targets()
dispatchMulti( --- cc
["multi", cf = vsnCfg], ... "compile with zig cc"
[ flags:
cc, `dry-run`:
usage = clUse, T bool
help = { ? "show command instead of executing"
"dryrun": "show command instead of executing", - n
"nimble": "use nimble as base command for compiling", nimble:
}, T bool
], ? "use nimble as base command for compiling"
[targets, usage = clUse], target:
[ ? "target triple"
release, - t
usage = clUse, run:
help = { cc(target, `dry-run`, nimble, args)
"target": "set target, may be repeated",
"bin": "set bin, may be repeated", --- release
"dryrun": "show command instead of executing", ... """
"format": "set format, see help above", generate release assets for n>=1 targets
"nimble": "use nimble as base command for compiling",
"config-file": "path to config", format argument:
"no-config": "ignore config file", format is a template string used for each target directory
}, available fields are name, version, target
short = {"verbose": 'V'}, default: ${name}-v${verison}-${target}
],
) if name or version are not specified they will be inferred from the local .nimble file
"""
flags:
verbose:
T bool
? "enable verbose"
- v
target:
T seq[string]
? "set target, may be repeated"
* @[]
- t
bin:
T seq[string]
? "set bin, may be repeated"
* @[]
`dry-run`:
T bool
? "show command instead of executing"
- n
format:
? "set format, see help above"
nimble:
T bool
? "use nimble as base command for compiling"
`config-file`:
? "path to config"
* ".forge.cfg"
`no-config`:
T bool
? "ignore config file"
outdir:
? "path to output dir"
* "dist"
- o
name:
? "set name, inferred otherwise"
* ""
version:
? "set version, inferred otherwise"
* ""
run:
release(
target,# seq[string] = @[],
bin, # seq[string] = @[],
args,# seq[string],
outdir,# string = "dist",
format,# string = "",
name,# string = "",
version,# string = "",
`dry-run`,# bool = false,
nimble,# bool = false,
`config-file`,# string = ".forge.cfg",
`no-config`,# bool = false,
verbose,# bool = false,
)
# [
# release,
# usage = clUse,
# help = {
# "target": "set target, may be repeated",
# "bin": "set bin, may be repeated",
# "dryrun": "show command instead of executing",
# "format": "set format, see help above",
# "nimble": "use nimble as base command for compiling",
# "config-file": "path to config",
# "no-config": "ignore config file",
# },
# short = {"verbose": 'V'},
# ],
# )