diff --git a/modules/json/manage.sh b/modules/json/manage.sh index df5e6db..443c408 100644 --- a/modules/json/manage.sh +++ b/modules/json/manage.sh @@ -86,12 +86,14 @@ managePatches() { .options |= . as $SAVED_OPTIONS | [ $AVAILABLE_OPTIONS[] | . as $OPTION | - if ($ARGS.positional | index($OPTION.patchName)) != null then + .patchName as $PATCH_NAME | + if ($ARGS.positional | index($PATCH_NAME)) != null then .title as $TITLE | .key as $KEY | .default as $DEFAULT | { "title": $TITLE, + "patchName": $PATCH_NAME, "key": $KEY, "value": (($SAVED_OPTIONS[]? | select(.key == $KEY) | .value) // $DEFAULT) } diff --git a/modules/patch.sh b/modules/patch.sh index 4c3a4fb..46d4cfb 100644 --- a/modules/patch.sh +++ b/modules/patch.sh @@ -37,19 +37,27 @@ patchApp() { readarray -t ARGUMENTS < <(jq -nrc --arg PKG_NAME "$PKG_NAME" --argjson ENABLED_PATCHES "$ENABLED_PATCHES" ' $ENABLED_PATCHES[] | select(.pkgName == $PKG_NAME) | - (.patches[] | "--enable", .), + .options as $OPTIONS | + .patches[] | + . as $PATCH_NAME | + "--enable", + $PATCH_NAME, ( - .options[] | - "--options=" + - .key + "=" + - ( - .value | - if . != null then - . | tostring | sub("[\" ]"; ""; "g") - else - "" - end - ) + $OPTIONS[] | + if .patchName == $PATCH_NAME then + "--options=" + + .key + "=" + + ( + .value | + if . != null then + . | tostring | sub("[\" ]"; ""; "g") + else + empty + end + ) + else + empty + end ) ' )