Skip to content

Commit

Permalink
jshn.sh: Add anonymous strings in arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
pprindeville committed Apr 1, 2024
1 parent 109b6f3 commit 5068553
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sh/jshn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,17 @@ json_add_string() {
_json_add_generic string "$1" "$2" "$cur"
}

json_push_string() {
local cur
_json_get_var cur JSON_CUR
[ "${cur%%[0-9]*}" = "J_A" ] || {
[ -n "$_json_no_warning" ] || \
echo "WARNING: Not in an array" >&2
return 1
}
_json_add_generic string "" "$2" "$cur"
}

json_add_int() {
local cur
_json_get_var cur JSON_CUR
Expand Down

0 comments on commit 5068553

Please sign in to comment.