#!/bin/sh # shellcheck disable=SC1091 . "$_SCRIPT_PATH"/_sources/_url.sh . "$_SCRIPT_PATH"/_sources/_zip.sh _parse_args() { # <- { "a": "b", "c": "d" } # -> a # -> b # -> c # -> d jq --raw-output --exit-status \ 'to_entries[] | "\(.key)\n\(.value)"' } read_args() { while read -r key; read -r value; do debug "read: $key=$value" if contains "$key" "$@"; then debug "set: arg_$key" # The eval here might look scary, but we know that $key # is safe and we escape $value. eval "arg_$key=\$value" fi done <