mirror of
https://github.com/daylinmorgan/forge.git
synced 2024-11-14 21:17:54 -06:00
update to newer hwylterm
This commit is contained in:
parent
19df564645
commit
b77b2489cc
3 changed files with 114 additions and 48 deletions
|
@ -8,7 +8,4 @@ binDir = "bin"
|
|||
|
||||
|
||||
requires "nim >= 2.0.0"
|
||||
requires "cligen"
|
||||
requires "https://github.com/daylinmorgan/hwylterm#HEAD"
|
||||
|
||||
|
||||
requires "https://github.com/daylinmorgan/hwylterm#dfd9a7d"
|
||||
|
|
14
nimble.lock
14
nimble.lock
|
@ -1,24 +1,14 @@
|
|||
{
|
||||
"version": 2,
|
||||
"packages": {
|
||||
"cligen": {
|
||||
"version": "1.7.5",
|
||||
"vcsRevision": "85daafd76b0104387f50ff3f75c829b4c2804412",
|
||||
"url": "https://github.com/c-blake/cligen.git",
|
||||
"downloadMethod": "git",
|
||||
"dependencies": [],
|
||||
"checksums": {
|
||||
"sha1": "f3ffe7329c8db755677d3ca377d02ff176cec8b1"
|
||||
}
|
||||
},
|
||||
"hwylterm": {
|
||||
"version": "0.1.0",
|
||||
"vcsRevision": "c2bcfd1f73dda97bd3e209c89e2abfe588f0977c",
|
||||
"vcsRevision": "dfd9a7d98d345510c9d248670b7e80f7501d1a5a",
|
||||
"url": "https://github.com/daylinmorgan/hwylterm",
|
||||
"downloadMethod": "git",
|
||||
"dependencies": [],
|
||||
"checksums": {
|
||||
"sha1": "1932229840c893c39acca0b50def19913678f5f0"
|
||||
"sha1": "7ed514f09d1f74f725c866ddb3cfba19cc8b3e42"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
143
src/forge.nim
143
src/forge.nim
|
@ -20,6 +20,7 @@ proc genFlags(target: string, args: seq[string] = @[]): seq[string] =
|
|||
|
||||
proc targets() =
|
||||
## show available targets
|
||||
zigExists()
|
||||
let targetList = zigTargets()
|
||||
termEcho "[bold green]available targets:".bb
|
||||
stderr.writeLine targetList.columns
|
||||
|
@ -118,39 +119,117 @@ proc release(
|
|||
termErrQuit &"exited with code {errCode} see above for error"
|
||||
|
||||
when isMainModule:
|
||||
import cligen
|
||||
import hwylterm/cli
|
||||
hwylCli(clCfg)
|
||||
# import cligen
|
||||
# TODO: swap for hwylterm/hwylcli
|
||||
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"
|
||||
|
||||
var vsnCfg = clCfg
|
||||
vsnCfg.version = vsn
|
||||
hwylCli:
|
||||
name "forge"
|
||||
V vsn
|
||||
subcommands:
|
||||
--- targets
|
||||
... "show available targets"
|
||||
run: targets()
|
||||
|
||||
dispatchMulti(
|
||||
["multi", cf = vsnCfg],
|
||||
[
|
||||
cc,
|
||||
usage = clUse,
|
||||
help = {
|
||||
"dryrun": "show command instead of executing",
|
||||
"nimble": "use nimble as base command for compiling",
|
||||
},
|
||||
],
|
||||
[targets, usage = clUse],
|
||||
[
|
||||
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'},
|
||||
],
|
||||
)
|
||||
--- cc
|
||||
... "compile with zig cc"
|
||||
flags:
|
||||
`dry-run`:
|
||||
T bool
|
||||
? "show command instead of executing"
|
||||
- n
|
||||
nimble:
|
||||
T bool
|
||||
? "use nimble as base command for compiling"
|
||||
target:
|
||||
? "target triple"
|
||||
- t
|
||||
run:
|
||||
cc(target, `dry-run`, nimble, args)
|
||||
|
||||
--- release
|
||||
... """
|
||||
generate release assets for n>=1 targets
|
||||
|
||||
format argument:
|
||||
format is a template string used for each target directory
|
||||
available fields are name, version, target
|
||||
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'},
|
||||
# ],
|
||||
# )
|
||||
|
|
Loading…
Reference in a new issue