summaryrefslogtreecommitdiff
path: root/bos-namespaces.sh
diff options
context:
space:
mode:
authordakkar <dakkar@thenautilus.net>2023-07-22 12:35:39 +0100
committerdakkar <dakkar@thenautilus.net>2023-07-22 12:35:39 +0100
commit6b3f9cb909df162345d9f5a001abeb0d3df31ce9 (patch)
tree32d89ba43faaea0ebfe69f9aaa8f002c7b9e57bd /bos-namespaces.sh
parentmove tests to actual test programs (diff)
downloadbash-object-system-6b3f9cb909df162345d9f5a001abeb0d3df31ce9.tar.gz
bash-object-system-6b3f9cb909df162345d9f5a001abeb0d3df31ce9.tar.bz2
bash-object-system-6b3f9cb909df162345d9f5a001abeb0d3df31ce9.zip
`*-into` always takes the destination as `$1`
Diffstat (limited to 'bos-namespaces.sh')
-rw-r--r--bos-namespaces.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/bos-namespaces.sh b/bos-namespaces.sh
index a208e02..0cb794a 100644
--- a/bos-namespaces.sh
+++ b/bos-namespaces.sh
@@ -2,8 +2,8 @@
## namespace handling
function bos-namespaces/encode-into() {
- local string="$1"
- local -n result="$2"
+ local -n result="$1"
+ local string="$2"
local idx char tmp
result=''
@@ -18,22 +18,22 @@ function bos-namespaces/encode-into() {
}
function bos-namespaces/store-scalar-for-into() {
- local name; bos-namespaces/encode-into "bos_${2}_${1}" name
- local -n result="$3"
+ local -n result="$1"
+ local name; bos-namespaces/encode-into name "bos_${3}_${2}"
declare -g "$name"
result="$name"
}
function bos-namespaces/store-array-for-into() {
- local name; bos-namespaces/encode-into "bos_${2}_${1}" name
- local -n result="$3"
+ local -n result="$1"
+ local name; bos-namespaces/encode-into name "bos_${3}_${2}"
declare -ga "$name"
result="$name"
}
function bos-namespaces/store-dict-for-into() {
- local name; bos-namespaces/encode-into "bos_${2}_${1}" name
- local -n result="$3"
+ local -n result="$1"
+ local name; bos-namespaces/encode-into name "bos_${3}_${2}"
declare -gA "$name"
result="$name"
}
@@ -41,7 +41,7 @@ function bos-namespaces/store-dict-for-into() {
# save all currently-visible functions in an associative array
function bos-namespaces/start() {
local namespace="$1";shift
- local ns_store; bos-namespaces/store-dict-for-into saved_funcs "$namespace" ns_store
+ local ns_store; bos-namespaces/store-dict-for-into ns_store saved_funcs "$namespace"
local -n saved_funcs="$ns_store"
local _ funcname
@@ -55,9 +55,9 @@ function bos-namespaces/start() {
# diff all currently-visible function against the saved ones, list the
# ones that differ
function bos-namespaces/list-new-funcs-into() {
- local namespace="$1";shift
local -n result="$1"
- local ns_store; bos-namespaces/store-dict-for-into saved_funcs "$namespace" ns_store
+ local namespace="$2"
+ local ns_store; bos-namespaces/store-dict-for-into ns_store saved_funcs "$namespace"
local -n saved_funcs="$ns_store"
local _ funcname new_function
@@ -75,7 +75,7 @@ function bos-namespaces/list-new-funcs-into() {
# saved function of the same name, if it exists
function bos-namespaces/qualify-funcs() {
local namespace="$1";shift
- local ns_store; bos-namespaces/store-dict-for-into saved_funcs "$namespace" ns_store
+ local ns_store; bos-namespaces/store-dict-for-into ns_store saved_funcs "$namespace"
local -n saved_funcs="$ns_store"
local _ funcname new_function