1
0

fix args parser (again), more output

This commit is contained in:
GenZmeY 2022-02-14 04:11:24 +03:00
parent f6b7fdd82f
commit 844ab522d3

22
builder
View File

@ -102,6 +102,7 @@ RED=''
GRN='' GRN=''
# shellcheck disable=SC2034 # shellcheck disable=SC2034
YLW='' YLW=''
BLU=''
DEF='' DEF=''
BLD='' BLD=''
@ -117,19 +118,19 @@ function get_latest () # $1: Reponame, $2: filename, $3: output filename
LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")') LatestTag=$(curl --silent "$ApiUrl" | grep -Po '"tag_name": "\K.*?(?=")')
local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2" local DownloadUrl="https://github.com/$1/releases/download/$LatestTag/$2"
msg "download $2 ($LatestTag)"
mkdir -p "$(dirname "$3")/" mkdir -p "$(dirname "$3")/"
curl -LJs "$DownloadUrl" -o "$3" curl -LJs "$DownloadUrl" -o "$3"
msg "successfully downloaded"
} }
function get_latest_multini () # $1: file to save function get_latest_multini () # $1: file to save
{ {
msg "download latest multini"
get_latest "GenZmeY/multini" "multini-windows-amd64.exe" "$1" get_latest "GenZmeY/multini" "multini-windows-amd64.exe" "$1"
} }
function get_latest_kfeditor_patcher () # $1: file to save function get_latest_kfeditor_patcher () # $1: file to save
{ {
msg "download latest kfeditor-patcher"
get_latest "notpeelz/kfeditor-patcher" "kfeditor_patcher.exe" "$1" get_latest "notpeelz/kfeditor-patcher" "kfeditor_patcher.exe" "$1"
} }
@ -143,6 +144,7 @@ function setup_colors ()
GRN='\e[32m' GRN='\e[32m'
# shellcheck disable=SC2034 # shellcheck disable=SC2034
YLW='\e[33m' YLW='\e[33m'
BLU='\e[34m'
DEF='\e[0m' DEF='\e[0m'
BLD='\e[1m' BLD='\e[1m'
fi fi
@ -158,7 +160,11 @@ function err () # $1: String
function msg () # $1: String function msg () # $1: String
{ {
if ! is_true "$ArgQuiet"; then if ! is_true "$ArgQuiet"; then
echo -e "${DEF}${1-}" >&1 if is_true "$ArgDebug"; then
echo -e "${BLU}${1-}${DEF}" >&1
else
echo -e "${DEF}${1-}" >&1
fi
fi fi
} }
@ -296,7 +302,7 @@ function merge_package () # $1: What, $2: Where
local ModificationTimeNew="" local ModificationTimeNew=""
local PID="" local PID=""
msg "merge $1 to $2" msg "merge $1 into $2"
if is_true "$ArgWarnings"; then if is_true "$ArgWarnings"; then
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorMergePackages") make $1 $2" CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorMergePackages") make $1 $2"
@ -515,7 +521,9 @@ function brew_manual ()
get_latest_kfeditor_patcher "$KFEditorPatcher" get_latest_kfeditor_patcher "$KFEditorPatcher"
fi fi
msg "patching $(basename $KFEditor)"
CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorPatcher")" CMD //C "cd /D $(cygpath -w "$KFWin64") && $(basename "$KFEditorPatcher")"
msg "successfully patched"
for Package in $PackageUpload for Package in $PackageUpload
do do
@ -523,6 +531,8 @@ function brew_manual ()
mv "$KFWin64/$Package.u" "$KFPublishBrewedPC" mv "$KFWin64/$Package.u" "$KFPublishBrewedPC"
done done
msg "successfully brewed"
publish_common publish_common
find "$KFPublish" -type d -empty -delete find "$KFPublish" -type d -empty -delete
@ -674,7 +684,7 @@ function parse_combined_params () # $1: Combined short parameters
while true while true
do do
if [[ $((Position + 1)) -gt "$Length" ]]; then break; fi if [[ $((Position + 1)) -ge "$Length" ]]; then break; fi
case "${Param:$Position:2}" in case "${Param:$Position:2}" in
ib ) ((Position+=2)); ArgInitBuild="true" ;; ib ) ((Position+=2)); ArgInitBuild="true" ;;
it ) ((Position+=2)); ArgInitTest="true" ;; it ) ((Position+=2)); ArgInitTest="true" ;;
@ -682,7 +692,7 @@ function parse_combined_params () # $1: Combined short parameters
nc ) ((Position+=2)); ArgNoColors="true" ;; nc ) ((Position+=2)); ArgNoColors="true" ;;
esac esac
if [[ "$Position" -gt "$Length" ]]; then break; fi if [[ "$Position" -ge "$Length" ]]; then break; fi
case "${Param:$Position:1}" in case "${Param:$Position:1}" in
h ) ((Position+=1)); ArgHelp="true" ;; h ) ((Position+=1)); ArgHelp="true" ;;
v ) ((Position+=1)); ArgVersion="true" ;; v ) ((Position+=1)); ArgVersion="true" ;;