Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Builder Robot
eepm
Commits
8792cb0e
Commit
8792cb0e
authored
Dec 10, 2025
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-sh-functions: fix get_json_value/get_json_values
parent
fc93d22a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
epm-sh-functions
bin/epm-sh-functions
+2
-2
test_json.sh
tests/test_json.sh
+40
-3
No files found.
bin/epm-sh-functions
View file @
8792cb0e
...
...
@@ -809,14 +809,14 @@ get_json_value()
{
local
field
=
"
$1
"
echo
"
$field
"
|
grep
-q
-E
"^
\[
"
||
field
=
'["'
$field
'"]'
epm
tool json
-b
|
grep
-m1
-F
"
$field
"
|
sed
-e
's|.*
[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
epm
--quiet
tool json
-b
|
grep
-m1
-F
"
$field
"
|
sed
-e
's|.*\]
[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
}
get_json_values
()
{
local
field
=
"
$1
"
echo
"
$field
"
|
grep
-q
-E
"^
\[
"
||
field
=
"
\[
$(
echo
"
$field
"
|
sed
's/[^ ]*/"&"/g'
|
sed
's/ /,/g'
)
,[0-9]*
\]
"
epm
tool json
-b
|
grep
"^
$field
"
|
sed
-e
's|.*
[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
epm
--quiet
tool json
-b
|
grep
"^
$field
"
|
sed
-e
's|.*\]
[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
}
__epm_assure_7zip
()
...
...
tests/test_json.sh
View file @
8792cb0e
#!/bin/sh
# ["version"]
parse
_json_value
()
get
_json_value
()
{
local
field
=
"
$1
"
echo
"
$field
"
|
grep
-q
-E
"^
\[
"
||
field
=
'["'
$field
'"]'
epm tool json
-b
|
grep
-m1
-F
"
$field
"
|
sed
-e
's|.*[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
# TODO: use grep and escape []
epm tool json
-b
|
grep
-m1
-F
"
$field
"
|
sed
-e
's|.*\][[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
}
get_json_values
()
{
local
field
=
"
$1
"
echo
"
$field
"
|
grep
-q
-E
"^
\[
"
||
field
=
"
\[
$(
echo
"
$field
"
|
sed
's/[^ ]*/"&"/g'
|
sed
's/ /,/g'
)
,[0-9]*
\]
"
epm tool json
-b
|
grep
"^
$field
"
|
sed
-e
's|.*[[:space:]]||'
|
sed
-e
's|"\(.*\)"|\1|g'
}
# ["version"] "0.48.8"
# ["downloadUrl"] "https://downloads.cursor.com/production/7801a556824585b7f2721900066bc87c4a09b743/linux/arm64/Cursor-0.48.8-aarch64.AppImage"
# ["rehUrl"] "https://cursor.blob.core.windows.net/remote-releases/7801a556824585b7f2721900066bc87c4a09b743/vscode-reh-linux-arm64.tar.gz"
cat
<<
EOF
|
parse
_json_value "downloadUrl"
cat
<<
EOF
|
get
_json_value "downloadUrl"
{"version":"0.48.8","downloadUrl":"https://downloads.cursor.com/production/7801a556824585b7f2721900066bc87c4a09b743/linux/arm64/Cursor-0.48.8-aarch64.AppImage","rehUrl":"https://cursor.blob.core.windows.net/remote-releases/7801a556824585b7f2721900066bc87c4a09b743/vscode-reh-linux-arm64.tar.gz"}
EOF
print_test_json
()
{
cat
<<
EOF
{
"name": "kde",
"version": "6.4.5",
"installed": false,
"dependencies": [ "plasma-desktop", "lightdm", "lightdm-kde-greeter", "plasma-discover", "power-profiles-daemon", "qt6-wayland", "wayland-utils", "vulkan-tools"],
"description": "KDE Plasma is a powerful desktop environment with support for X11 and Wayland",
"metapackages": [ "kde" ]
}
EOF
}
echo
"=== name"
echo
"@
$(
print_test_json | get_json_value
"name"
)
@"
echo
"=== version"
echo
"@
$(
print_test_json | get_json_value
"version"
)
@"
echo
"=== installed"
echo
"@
$(
print_test_json | get_json_value
"installed"
)
@"
echo
"=== dependencies"
print_test_json | get_json_values
"dependencies"
| xargs
echo
"=== metapackages"
print_test_json | get_json_values
"metapackages"
echo
"=== description"
print_test_json | get_json_value
"description"
echo
"==="
print_test_json | epm tool json
-b
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment