diff --git a/.github/bin/install-zig b/.github/bin/install-zig index 4b1247c0..43c19026 100755 --- a/.github/bin/install-zig +++ b/.github/bin/install-zig @@ -44,9 +44,9 @@ case "${os}" in archive_sha256='1c1c6b9a906b42baae73656e24e108fd8444bb50b6e8fd03e9e7a3f8b5f05686' shasum -a 256 -c <<< "${archive_sha256} *${archive}" ;; - *) - echo "${os} not yet supported" >&2 - exit 1 + windows) + archive_sha256='142caa3b804d86b4752556c9b6b039b7517a08afa3af842645c7e2dcd125f652' + # TODO: check windows archive checksum ;; esac diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27bf092f..5132928d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -84,6 +84,9 @@ jobs: - runs-on: macos-12 zig_target: aarch64-macos-none + - runs-on: windows-2022 + zig_target: aarch64-windows-gnu + name: "${{ matrix.zig_target }}" runs-on: ${{ matrix.runs-on }} permissions: diff --git a/src/cli.nim b/src/cli.nim index c6859051..32b287d5 100644 --- a/src/cli.nim +++ b/src/cli.nim @@ -116,8 +116,7 @@ func genShortKeys: array[Opt, char] = result[opt] = ($opt)[0] const - repoRootDir = currentSourcePath().parentDir().parentDir() - configletVersion = staticRead(repoRootDir / "configlet.version").strip() + configletVersion = staticRead("../configlet.version").strip() short = genShortKeys() optsNoVal = {optHelp, optVersion, optFmtSyncUpdate, optFmtSyncYes, optInfoSyncOffline, optSyncDocs, optSyncFilepaths, optSyncMetadata} diff --git a/src/completion/completion.nim b/src/completion/completion.nim index a322786e..fe5a7851 100644 --- a/src/completion/completion.nim +++ b/src/completion/completion.nim @@ -6,7 +6,13 @@ proc readCompletions: array[Shell, string] = const repoRootDir = currentSourcePath().parentDir().parentDir().parentDir() const completionsDir = repoRootDir / "completions" for shell in sBash .. result.high: - result[shell] = staticRead(completionsDir / &"configlet.{shell}").compress() + # When cross-compiling for Windows from Linux, replace the `\\` DirSep with `/`. + var path = completionsDir / &"configlet.{shell}" + when defined(windows) and defined(zig) and staticExec("uname") == "Linux": + for c in path.mitems: + if c == '\\': + c = '/' + result[shell] = staticRead(path).compress() proc completion*(shellKind: Shell) = const completions = readCompletions()