summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Prindeville2023-09-15 19:53:02 +0000
committerRobert Marko2026-02-12 15:57:28 +0000
commit5a65cb5a79b757d24beeab4144333b012a4935ec (patch)
tree1a19f2ed38fe3fe48c670472ccb2435da286e2cf
parentd324c0503040914dd125298093c83fd07bf9f012 (diff)
downloadlibubox-5a65cb5a79b757d24beeab4144333b012a4935ec.tar.gz
libubox: document positional arguments
Use local variables for positional arguments where they're captured, and provide comments for position arguments. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Link: https://github.com/openwrt/libubox/pull/12 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--sh/jshn.sh7
1 files changed, 5 insertions, 2 deletions
diff --git a/sh/jshn.sh b/sh/jshn.sh
index 4d3f8c0..61a6a2e 100644
--- a/sh/jshn.sh
+++ b/sh/jshn.sh
@@ -236,6 +236,7 @@ json_dump() {
}
json_get_type() {
+ # target=$2
local __dest="$1"
local __cur
@@ -305,11 +306,11 @@ json_select() {
local type
local cur
- [ -z "$1" ] && {
+ [ -z "$target" ] && {
_json_set_var JSON_CUR "J_V"
return 0
}
- [[ "$1" == ".." ]] && {
+ [[ "$target" == ".." ]] && {
_json_get_var cur JSON_CUR
_json_get_var cur "U_$cur"
_json_set_var JSON_CUR "$cur"
@@ -330,6 +331,8 @@ json_select() {
}
json_is_a() {
+ # target=$1
+ # type=$2
local type
json_get_type type "$1"