Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix scoop-gen
  • Loading branch information
mislav committed Oct 2, 2020
1 parent 4195663 commit 2376c81
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions script/scoop-gen
Expand Up @@ -3,28 +3,29 @@
set -e

tagname="${1?}"
version="${tagname#v}"
urlprefix="https://github.com/cli/cli/releases/download/$tagname/"
jsonfile="${2?}"

jq_args=(
--arg version "$version"
--arg version "${tagname#v}"
--arg urlprefix "https://github.com/cli/cli/releases/download/$tagname/"
$(cat | awk '
/windows_386/ {
printf "--arg win32hash \"%s\"\n", $1
printf "--arg win32file \"%s\"\n", $2
printf "--arg win32hash %s\n", $1
printf "--arg win32file %s\n", $2
}
/windows_amd64/ {
printf "--arg win64hash \"%s\"\n", $1
printf "--arg win64file \"%s\"\n", $2
printf "--arg win64hash %s\n", $1
printf "--arg win64file %s\n", $2
}
')
)

jq '
.version = $version |
.architecture."32bit".url = $win32file |
.architecture."32bit".url = $urlprefix + $win32file |
.architecture."32bit".hash = $win32hash |
.architecture."64bit".url = $win64file |
.architecture."64bit".url = $urlprefix + $win64file |
.architecture."64bit".hash = $win64hash
' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~

mv "$jsonfile"{~,}

0 comments on commit 2376c81

Please sign in to comment.