File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ function foo() {
2929
3030 exitIfArgIsNotArray arr 1
3131 exitIfArgIsNotArrayOrIsEmpty arr 1
32+ exitIfArgIsNotArrayOrIsNonEmpty arr 1
3233 exitIfArgIsNotFunction " $fn " 2
3334 exitIfArgIsNotBoolean " $bool " 3
3435 exitIfArgIsNotVersion " $version " 4
Original file line number Diff line number Diff line change @@ -125,10 +125,16 @@ function exitIfArgIsNotArray() {
125125function exitIfArgIsNotArrayOrIsEmpty() {
126126 exitIfArgIsNotArray " $@ "
127127 local -rn exitIfArgIsNotArrayOrIsEmpty_arr=$1
128- local -r argNumberOrName=$2
129- shift 2 || traceAndDie " could not shift by 2"
130128 if [[ ${# exitIfArgIsNotArrayOrIsEmpty_arr[@]} -lt 1 ]]; then
131- traceAndDie " the passed argument \033[0;36m%s\033[0m is an empty array" " ${! checkArgIsArray_arr} "
129+ traceAndDie " the passed argument \033[0;36m%s\033[0m is an empty array" " ${! exitIfArgIsNotArrayOrIsEmpty_arr} "
130+ fi
131+ }
132+
133+ function exitIfArgIsNotArrayOrIsNonEmpty() {
134+ exitIfArgIsNotArray " $@ "
135+ local -rn exitIfArgIsNotArrayOrIsNonEmpty_arr=$1
136+ if [[ ${# exitIfArgIsNotArrayOrIsNonEmpty_arr[@]} -gt 0 ]]; then
137+ traceAndDie " the passed argument \033[0;36m%s\033[0m is a non empty array" " ${! exitIfArgIsNotArrayOrIsNonEmpty_arr} "
132138 fi
133139}
134140
You can’t perform that action at this time.
0 commit comments