Skip to content

Commit

Permalink
use bracketed object accessor syntax for compatibility with older jq …
Browse files Browse the repository at this point in the history
…versions, fixes anestisb#166
  • Loading branch information
asnelling committed Jul 20, 2019
1 parent e853d17 commit c7cdf15
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jqRawStrTop() {
local query="$1"
local conf_file="$2"

jq -r ".\"$query\"" "$conf_file" || {
jq -r ".[\"$query\"]" "$conf_file" || {
echo "[-] json raw top string parse failed" >&2
abort 1
}
Expand All @@ -78,7 +78,7 @@ jqIncRawArrayTop() {
local query="$1"
local conf_file="$2"

jq -r ".\"$query\"[]" "$conf_file" || {
jq -r ".[\"$query\"][]" "$conf_file" || {
echo "[-] json top raw string string parse failed" >&2
abort 1
}
Expand All @@ -90,7 +90,7 @@ jqRawStr() {
local query="$3"
local conf_file="$4"

jq -r ".\"$api\".\"$conf\".\"$query\"" "$conf_file" || {
jq -r ".[\"$api\"][\"$conf\"][\"$query\"]" "$conf_file" || {
echo "[-] json raw string parse failed" >&2
abort 1
}
Expand All @@ -102,7 +102,7 @@ jqIncRawArray() {
local query="$3"
local conf_file="$4"

jq -r ".\"$api\".naked.\"$query\"[]" "$conf_file" || {
jq -r ".[\"$api\"].naked[\"$query\"][]" "$conf_file" || {
echo "[-] json raw string array parse failed" >&2
abort 1
}
Expand All @@ -111,7 +111,7 @@ jqIncRawArray() {
return
fi

jq -r ".\"$api\".full.\"$query\"[]" "$conf_file" || {
jq -r ".[\"$api\"].full[\"$query\"][]" "$conf_file" || {
echo "[-] json raw string array parse failed" >&2
abort 1
}
Expand Down

0 comments on commit c7cdf15

Please sign in to comment.