Skip to content
This repository was archived by the owner on Dec 6, 2025. It is now read-only.

Commit fe9316e

Browse files
committed
fix: breaking changes for jq v1.8.0
1 parent 1d99c03 commit fe9316e

3 files changed

Lines changed: 27 additions & 22 deletions

File tree

modules/json/cli.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ parseJsonFromCLI() {
128128
elif $TYPE == $NUMBER then
129129
tonumber
130130
elif $TYPE == $BOOLEAN then
131-
test("true")
131+
toboolean
132132
elif $TYPE == $STRINGARRAY then
133133
(gsub("(?<a>([^,\\[\\] ]+))" ; "\"" + .a + "\"") | fromjson)
134134
end
@@ -142,7 +142,7 @@ parseJsonFromCLI() {
142142
"key": $KEY,
143143
"title": $TITLE,
144144
"description": $DESCRIPTION,
145-
"required": ($REQUIRED | test("true")),
145+
"required": ($REQUIRED | toboolean),
146146
"type": $TYPE,
147147
"default": $DEFAULT,
148148
"values": $ARGS.positional
@@ -163,7 +163,7 @@ parseJsonFromCLI() {
163163
map(
164164
if .pkgName == $PKG_NAME then
165165
.patches |= (
166-
if ($USE | test("true")) then
166+
if ($USE | toboolean) then
167167
.recommended += [$PATCH_NAME]
168168
else
169169
.optional += [$PATCH_NAME]

modules/json/options.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ editOptions() {
238238
null
239239
elif length == 1 then
240240
if $TYPE == $BOOLEAN then
241-
.[0] | test("true")
241+
.[0] | toboolean
242242
elif $TYPE == $NUMBER then
243243
.[0] | tonumber
244244
elif $TYPE == $STRING then

modules/json/patches.sh

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ managePatches() {
7575
esac
7676
done
7777

78+
clear
79+
7880
UPDATED_PATCHES=$(
7981
jq -nc --arg PKG_NAME "$PKG_NAME" --argjson AVAILABLE_PATCHES "$AVAILABLE_PATCHES" --argjson ENABLED_PATCHES "$ENABLED_PATCHES" '
8082
[
@@ -91,30 +93,33 @@ managePatches() {
9193
map(
9294
if .pkgName == $PKG_NAME then
9395
.patches |= [$ARGS.positional | if (.[0] == "") then empty else .[] end] |
94-
.options |= . as $SAVED_OPTIONS | [
95-
$AVAILABLE_OPTIONS[] |
96-
. as $OPTION |
97-
.patchName as $PATCH_NAME |
98-
if ($ARGS.positional | index($PATCH_NAME)) != null then
99-
.title as $TITLE |
100-
.key as $KEY |
101-
.default as $DEFAULT |
102-
{
103-
"title": $TITLE,
104-
"patchName": $PATCH_NAME,
105-
"key": $KEY,
106-
"value": (($SAVED_OPTIONS[]? | select(.key == $KEY and .patchName == $PATCH_NAME) | .value) // $DEFAULT)
107-
}
108-
else
109-
empty
110-
end
111-
]
96+
.options |= (
97+
. as $SAVED_OPTIONS | [
98+
$AVAILABLE_OPTIONS[] |
99+
. as $OPTION |
100+
.patchName as $PATCH_NAME |
101+
if ($ARGS.positional | index($PATCH_NAME)) != null then
102+
.title as $TITLE |
103+
.key as $KEY |
104+
.default as $DEFAULT |
105+
{
106+
"title": $TITLE,
107+
"patchName": $PATCH_NAME,
108+
"key": $KEY,
109+
"value": (($SAVED_OPTIONS[]? | select(.key == $KEY and .patchName == $PATCH_NAME) | .value) // $DEFAULT)
110+
}
111+
else
112+
empty
113+
end
114+
]
115+
)
112116
else
113117
.
114118
end
115119
)
116120
' --args "${ENABLED_PATCHES_LIST[@]}"
117121
)
122+
118123
echo "$UPDATED_PATCHES" > "$STORAGE/$SOURCE-patches.json"
119124
ENABLED_PATCHES="$UPDATED_PATCHES"
120125
}

0 commit comments

Comments
 (0)