Skip to content

Commit

Permalink
.github, cli, completion: cross-compile arm64 Windows asset
Browse files Browse the repository at this point in the history
  • Loading branch information
ee7 committed Aug 17, 2023
1 parent f280445 commit 80fd33b
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/bin/install-zig
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 1 addition & 2 deletions src/cli.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
8 changes: 7 additions & 1 deletion src/completion/completion.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 80fd33b

Please sign in to comment.