summaryrefslogtreecommitdiffhomepage
path: root/proto/netifd-proto.sh
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-09-10 14:40:25 +0200
committerFelix Fietkau <nbd@openwrt.org>2011-09-10 16:24:29 +0200
commit0e54c1a6088b7df98da521e4b60ac8b7e6429662 (patch)
tree869e69fa5b34f0de8763f111497055bd9e1532cf /proto/netifd-proto.sh
parent291f00a6aa1c519ab1a36e9279ee486c4e6a95f3 (diff)
proto-shell: parse shell handler metadata
Diffstat (limited to 'proto/netifd-proto.sh')
-rwxr-xr-xproto/netifd-proto.sh17
1 files changed, 12 insertions, 5 deletions
diff --git a/proto/netifd-proto.sh b/proto/netifd-proto.sh
index f850216..3764281 100755
--- a/proto/netifd-proto.sh
+++ b/proto/netifd-proto.sh
@@ -1,15 +1,22 @@
. /usr/share/libubox/jshn.sh
+proto_config_add_generic() {
+ json_add_array ""
+ json_add_string "" "$1"
+ json_add_int "" "$2"
+ json_close_array
+}
+
proto_config_add_int() {
- json_add_int "$1" 5
+ proto_config_add_generic "$1" 5
}
proto_config_add_string() {
- json_add_int "$1" 3
+ proto_config_add_generic "$1" 3
}
proto_config_add_boolean() {
- json_add_int "$1" 7
+ proto_config_add_generic "$1" 7
}
add_default_handler() {
@@ -30,9 +37,9 @@ case "$1" in
json_add_string "name" "$1"
eval "$1_init"
json_add_boolean immediate "$immediate"
- json_add_object "config"
+ json_add_array "config"
eval "$1_init_config"
- json_close_object
+ json_close_array
json_dump
}
;;