jshn: refactor _jshn_append to require fewer evals
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
This commit is contained in:
parent
dcbc14a701
commit
a34c8f6918
1 changed files with 3 additions and 6 deletions
|
@ -22,12 +22,9 @@ __jshn_raw_append() {
|
||||||
|
|
||||||
_jshn_append() {
|
_jshn_append() {
|
||||||
# var=$1
|
# var=$1
|
||||||
# value=$2
|
local _a_value="$2"
|
||||||
# sep=$3
|
local _a_sep="${3:- }"
|
||||||
local __old_val
|
eval "${JSON_PREFIX}$1=\"\${${JSON_PREFIX}$1:+\${${JSON_PREFIX}$1}\${_a_value:+\$_a_sep}}\$_a_value\""
|
||||||
|
|
||||||
_json_get_var __old_val "$1"
|
|
||||||
_json_set_var "$1" "${__old_val:+$__old_val${3:- }}$2"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_json_export() {
|
_json_export() {
|
||||||
|
|
Loading…
Reference in a new issue