File tree Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Expand file tree Collapse file tree 3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,6 @@ bash_object.traverse-get() {
48
48
local key=" ${REPLIES[$i]} "
49
49
filter_stack+=(" $key " )
50
50
51
- # TODO: redo filter_stack string, and use stdlib.arrayprint TODO
52
- local oldIFS=" $IFS "
53
- IFS=' _'
54
- local filter_stack_string=" ${filter_stack[*]} "
55
- IFS=" $oldIFS "
56
-
57
51
bash_object.trace_loop
58
52
59
53
local is_index_of_array=' no'
@@ -64,7 +58,7 @@ bash_object.traverse-get() {
64
58
65
59
# If 'key' is not a member of object or index of array, error
66
60
if [ -z " ${current_object["$key"]+x} " ]; then
67
- bash_object.util.die ' ERROR_VALUE_NOT_FOUND' " Key or index '$key ' is not in ' $filter_stack_string ' "
61
+ bash_object.util.die ' ERROR_VALUE_NOT_FOUND' " Key or index '$key ' (filter index ' $i ') does not exist "
68
62
return
69
63
# If 'key' is a member of an object or index of array
70
64
else
Original file line number Diff line number Diff line change @@ -122,19 +122,16 @@ bash_object.traverse-set() {
122
122
for (( i= 0 ; i< ${# REPLIES[@]} ; i++ )) ; do
123
123
local key=" ${REPLIES[$i]} "
124
124
filter_stack+=(" $key " )
125
-
126
- local oldIFS=" $IFS "
127
- IFS=' _'
128
- local filter_stack_string=" ${filter_stack[*]} "
129
- IFS=" $oldIFS "
125
+ bash_object.util.generate_filter_stack_string
126
+ local filter_stack_string=" $REPLY "
130
127
131
128
bash_object.trace_loop
132
129
133
130
# If 'key' is not a member of object or index of array, error
134
131
if [ -z " ${current_object["$key"]+x} " ]; then
135
132
# If we are before the last element in the query, then error
136
133
if (( i+ 1 < ${# REPLIES[@]} )) ; then
137
- bash_object.util.die ' ERROR_VALUE_NOT_FOUND' " Key or index '$key ' is not in ' $filter_stack_string ' "
134
+ bash_object.util.die ' ERROR_VALUE_NOT_FOUND' " Key or index '$key ' (filter index ' $i ') does not exist "
138
135
return
139
136
# If we are at the last element in the query
140
137
elif (( i+ 1 == ${# REPLIES[@]} )) ; then
Original file line number Diff line number Diff line change @@ -57,6 +57,18 @@ bash_object.util.generate_vobject_name() {
57
57
REPLY=" __bash_object_${root_object_name} _${root_object_query} _${random_string} "
58
58
}
59
59
60
+ # @description A stringified version of the filter
61
+ # stack. This is used when generating objects to prevent
62
+ # conflicts
63
+ bash_object.util.generate_filter_stack_string () {
64
+ unset REPLY
65
+
66
+ local oldIFS=" $IFS "
67
+ IFS=' _'
68
+ REPLY=" ${filter_stack[*]} "
69
+ IFS=" $oldIFS "
70
+ }
71
+
60
72
# TODO
61
73
stdtrace.log () {
62
74
local level=" $1 "
You can’t perform that action at this time.
0 commit comments