From b0a5545ebc0f0372e58a09b5721cef4d0b66316d Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Sun, 10 Nov 2024 12:48:23 -0600 Subject: [PATCH] more updates for hwylcli transition --- forge.nimble | 2 +- nimble.lock | 4 +-- src/forge.nim | 81 ++++++++++++++++----------------------------------- 3 files changed, 28 insertions(+), 59 deletions(-) diff --git a/forge.nimble b/forge.nimble index 82b02e9..7a84eb5 100644 --- a/forge.nimble +++ b/forge.nimble @@ -8,4 +8,4 @@ binDir = "bin" requires "nim >= 2.0.0" -requires "https://github.com/daylinmorgan/hwylterm#dfd9a7d" +requires "https://github.com/daylinmorgan/hwylterm#e8e090c" diff --git a/nimble.lock b/nimble.lock index 799b40c..a17b21a 100644 --- a/nimble.lock +++ b/nimble.lock @@ -3,12 +3,12 @@ "packages": { "hwylterm": { "version": "0.1.0", - "vcsRevision": "dfd9a7d98d345510c9d248670b7e80f7501d1a5a", + "vcsRevision": "e8e090c5b76bc555231bda536193df6f92a54db2", "url": "https://github.com/daylinmorgan/hwylterm", "downloadMethod": "git", "dependencies": [], "checksums": { - "sha1": "7ed514f09d1f74f725c866ddb3cfba19cc8b3e42" + "sha1": "925aad3ce660979de7cdb2f58a31dc7ac693e34d" } } }, diff --git a/src/forge.nim b/src/forge.nim index 58aa4f3..5ce7f7a 100644 --- a/src/forge.nim +++ b/src/forge.nim @@ -58,14 +58,6 @@ proc release( noConfig: bool = false, verbose: bool = false, ) = - ## 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 zigExists() let cfg = @@ -119,17 +111,22 @@ proc release( termErrQuit &"exited with code {errCode} see above for error" when isMainModule: - # import cligen - # TODO: swap for hwylterm/hwylcli import hwylterm/hwylcli - # hwylCli(clCfg) - - # let clUse* = $bb("$command $args\n${doc}[bold]Options[/]:\n$options") - const vsn = staticExec "git describe --tags --always HEAD" + const vsn{.strDefine.} = staticExec "git describe --tags --always HEAD" hwylCli: name "forge" + ... "cross-compile nim binaries with [b yellow]zig[/]" V vsn + flags: + [shared] + `dry-run`: + T bool + ? "show command instead of executing" + - n + nimble: + T bool + ? "use nimble as base command for compiling" subcommands: --- targets ... "show available targets" @@ -138,13 +135,7 @@ when isMainModule: --- 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" + ^[shared] target: ? "target triple" - t @@ -163,6 +154,7 @@ when isMainModule: if name or version are not specified they will be inferred from the local .nimble file """ flags: + ^[shared] verbose: T bool ? "enable verbose" @@ -176,15 +168,8 @@ when isMainModule: 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" @@ -203,33 +188,17 @@ when isMainModule: * "" 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, + target, + bin, + args, + outdir, + format, + name, + version, + `dry-run`, + nimble, + `config-file`, + `no-config`, + verbose, ) - - # [ - # 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'}, - # ], - # )