mirror of
https://github.com/oSoWoSo/DistroHopper.git
synced 2024-08-14 22:46:53 +00:00
Add list_json()
As we now have valid CSV, pipe that into a jq filter to generate JSON. https://stackoverflow.com/a/67359273
This commit is contained in:
parent
6cba256d79
commit
ecd4ed043e
1 changed files with 8 additions and 1 deletions
9
quickget
9
quickget
|
@ -59,7 +59,12 @@ function validate_release() {
|
|||
fi
|
||||
}
|
||||
|
||||
function list_all() {
|
||||
function list_json() {
|
||||
# Reference: https://stackoverflow.com/a/67359273
|
||||
list_csv | jq -R 'split(",") as $h|reduce inputs as $in ([]; . += [$in|split(",")|. as $a|reduce range(0,length) as $i ({};.[$h[$i]]=$a[$i])])'
|
||||
exit 0
|
||||
}
|
||||
|
||||
function list_csv() {
|
||||
local DISPLAY_NAME
|
||||
local FUNC
|
||||
|
@ -823,6 +828,8 @@ if [ -n "${1}" ]; then
|
|||
OS="${1,,}"
|
||||
if [ "${OS}" == "list" ] || [ "${OS}" == "list_csv" ]; then
|
||||
list_csv
|
||||
elif [ "${OS}" == "list_json" ]; then
|
||||
list_json
|
||||
fi
|
||||
else
|
||||
echo "ERROR! You must specify an operating system:"
|
||||
|
|
Loading…
Reference in a new issue