github.com/abdfnx/gh-api@v0.0.0-20210414084727-f5432eec23b8/script/scoop-gen (about) 1 #!/bin/bash 2 # Usage: cat checksums.txt | script/scoop-gen <version> <json-file> 3 set -e 4 5 tagname="${1?}" 6 jsonfile="${2?}" 7 8 jq_args=( 9 --arg version "${tagname#v}" 10 --arg urlprefix "https://github.com/cli/cli/releases/download/$tagname/" 11 $(cat | awk ' 12 /windows_386/ { 13 printf "--arg win32hash %s\n", $1 14 printf "--arg win32file %s\n", $2 15 } 16 /windows_amd64/ { 17 printf "--arg win64hash %s\n", $1 18 printf "--arg win64file %s\n", $2 19 } 20 ') 21 ) 22 23 jq ' 24 .version = $version | 25 .architecture."32bit".url = $urlprefix + $win32file | 26 .architecture."32bit".hash = $win32hash | 27 .architecture."64bit".url = $urlprefix + $win64file | 28 .architecture."64bit".hash = $win64hash 29 ' "${jq_args[@]}" --indent 4 "$jsonfile" > "$jsonfile"~ 30 31 mv "$jsonfile"{~,}