Skip to content

Commit

Permalink
fix: pass option after corresponding patch
Browse files Browse the repository at this point in the history
  • Loading branch information
decipher3114 committed Nov 24, 2024
1 parent 40bd035 commit a53f29e
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
4 changes: 3 additions & 1 deletion modules/json/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
32 changes: 20 additions & 12 deletions modules/patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
'
)
Expand Down

0 comments on commit a53f29e

Please sign in to comment.