1
0
KF2-BuildTools/common.lib

30 lines
776 B
Plaintext
Raw Normal View History

2022-01-10 07:00:54 +00:00
#!/bin/bash
function reg_readkey () # $1: path, $2: key
{
cygpath -u $(
reg query "$1" //v "$2" | \
grep -F "$2" | \
awk '{ $1=$2=""; print $0 }' )
}
function get_latest () # $1: Reponame, $2: filename, $3: output filename
{
local ApiUrl="https://api.github.com/repos/$1/releases/latest"
local LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
mkdir -p $(dirname "$3")
curl -LJs "$DownloadUrl" -o "$3"
}
function get_latest_multini () # $1: file to save
{
get_latest "GenZmeY/multini" "multini-windows-amd64.exe" "$1"
}
function get_latest_kfeditor_patcher () # $1: file to save
{
get_latest "notpeelz/kfeditor-patcher" "kfeditor_patcher.exe" "$1"
}