diff options
author | Felix Fietkau <nbd@openwrt.org> | 2013-10-22 14:10:20 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2013-10-22 14:10:33 +0200 |
commit | f8d894ad5974c29471cfef6679a819ab5a7e4ef8 (patch) | |
tree | 336cce7efa1bf17da3697d84fb4eb1ed29f23ded /scripts/utils.sh | |
parent | 54cb6782c3f36dc98b75e65ea27236595d5b1858 (diff) |
scripts: make config_add_* parameters take multiple arguments
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Diffstat (limited to 'scripts/utils.sh')
-rw-r--r-- | scripts/utils.sh | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/scripts/utils.sh b/scripts/utils.sh index b01aae2..01d8ad5 100644 --- a/scripts/utils.sh +++ b/scripts/utils.sh @@ -14,24 +14,28 @@ add_default_handler() { } _config_add_generic() { - json_add_array "" - json_add_string "" "$1" - json_add_int "" "$2" - json_close_array + local type="$1"; shift + + for name in "$@"; do + json_add_array "" + json_add_string "" "$name" + json_add_int "" "$type" + json_close_array + done } config_add_int() { - _config_add_generic "$1" 5 + _config_add_generic 5 "$@" } config_add_array() { - _config_add_generic "$1" 1 + _config_add_generic 1 "$@" } config_add_string() { - _config_add_generic "$1" 3 + _config_add_generic 3 "$@" } config_add_boolean() { - _config_add_generic "$1" 7 + _config_add_generic 7 "$@" } |