Skip to content

Commit 9e7800b

Browse files
committed
- Add ability to catch arbitrary args and flags
1 parent d3a49e0 commit 9e7800b

File tree

24 files changed

+215
-0
lines changed

24 files changed

+215
-0
lines changed

examples/colors/colorly

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ inspect_args() {
6666
else
6767
echo args: none
6868
fi
69+
70+
if (( ${#other_args[@]} )); then
71+
echo
72+
echo other_args:
73+
echo "- \${other_args[@]} = ${other_args[@]}"
74+
for i in "${!other_args[@]}"; do
75+
echo "- \${other_args[$i]} = ${other_args[$i]}"
76+
done
77+
fi
6978
}
7079

7180
# :command.user_lib
@@ -172,6 +181,7 @@ initialize() {
172181
# :command.run
173182
run() {
174183
declare -A args
184+
declare -a other_args
175185
parse_requirements "$@"
176186

177187
if [[ $action == "root" ]]; then

examples/command-default/ftp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ inspect_args() {
122122
else
123123
echo args: none
124124
fi
125+
126+
if (( ${#other_args[@]} )); then
127+
echo
128+
echo other_args:
129+
echo "- \${other_args[@]} = ${other_args[@]}"
130+
for i in "${!other_args[@]}"; do
131+
echo "- \${other_args[$i]} = ${other_args[$i]}"
132+
done
133+
fi
125134
}
126135

127136
# :command.command_functions
@@ -348,6 +357,7 @@ initialize() {
348357
# :command.run
349358
run() {
350359
declare -A args
360+
declare -a other_args
351361
parse_requirements "$@"
352362

353363
if [[ $action == "upload" ]]; then

examples/command-groups/ftp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,15 @@ inspect_args() {
169169
else
170170
echo args: none
171171
fi
172+
173+
if (( ${#other_args[@]} )); then
174+
echo
175+
echo other_args:
176+
echo "- \${other_args[@]} = ${other_args[@]}"
177+
for i in "${!other_args[@]}"; do
178+
echo "- \${other_args[$i]} = ${other_args[$i]}"
179+
done
180+
fi
172181
}
173182

174183
# :command.command_functions
@@ -509,6 +518,7 @@ initialize() {
509518
# :command.run
510519
run() {
511520
declare -A args
521+
declare -a other_args
512522
parse_requirements "$@"
513523

514524
if [[ $action == "download" ]]; then

examples/commands-nested/cli

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,15 @@ inspect_args() {
252252
else
253253
echo args: none
254254
fi
255+
256+
if (( ${#other_args[@]} )); then
257+
echo
258+
echo other_args:
259+
echo "- \${other_args[@]} = ${other_args[@]}"
260+
for i in "${!other_args[@]}"; do
261+
echo "- \${other_args[$i]} = ${other_args[$i]}"
262+
done
263+
fi
255264
}
256265

257266
# :command.command_functions
@@ -747,6 +756,7 @@ initialize() {
747756
# :command.run
748757
run() {
749758
declare -A args
759+
declare -a other_args
750760
parse_requirements "$@"
751761

752762
if [[ $action == "dir" ]]; then

examples/commands/cli

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@ inspect_args() {
161161
else
162162
echo args: none
163163
fi
164+
165+
if (( ${#other_args[@]} )); then
166+
echo
167+
echo other_args:
168+
echo "- \${other_args[@]} = ${other_args[@]}"
169+
for i in "${!other_args[@]}"; do
170+
echo "- \${other_args[$i]} = ${other_args[$i]}"
171+
done
172+
fi
164173
}
165174

166175
# :command.command_functions
@@ -419,6 +428,7 @@ initialize() {
419428
# :command.run
420429
run() {
421430
declare -A args
431+
declare -a other_args
422432
parse_requirements "$@"
423433

424434
if [[ $action == "download" ]]; then

examples/config-ini/configly

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,15 @@ inspect_args() {
168168
else
169169
echo args: none
170170
fi
171+
172+
if (( ${#other_args[@]} )); then
173+
echo
174+
echo other_args:
175+
echo "- \${other_args[@]} = ${other_args[@]}"
176+
for i in "${!other_args[@]}"; do
177+
echo "- \${other_args[$i]} = ${other_args[$i]}"
178+
done
179+
fi
171180
}
172181

173182
# :command.user_lib
@@ -598,6 +607,7 @@ initialize() {
598607
# :command.run
599608
run() {
600609
declare -A args
610+
declare -a other_args
601611
parse_requirements "$@"
602612

603613
if [[ $action == "set" ]]; then

examples/custom-includes/download

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ inspect_args() {
6262
else
6363
echo args: none
6464
fi
65+
66+
if (( ${#other_args[@]} )); then
67+
echo
68+
echo other_args:
69+
echo "- \${other_args[@]} = ${other_args[@]}"
70+
for i in "${!other_args[@]}"; do
71+
echo "- \${other_args[$i]} = ${other_args[$i]}"
72+
done
73+
fi
6574
}
6675

6776
# :command.user_lib
@@ -144,6 +153,7 @@ initialize() {
144153
# :command.run
145154
run() {
146155
declare -A args
156+
declare -a other_args
147157
parse_requirements "$@"
148158

149159
if [[ $action == "root" ]]; then

examples/custom-strings/download

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ inspect_args() {
6565
else
6666
echo args: none
6767
fi
68+
69+
if (( ${#other_args[@]} )); then
70+
echo
71+
echo other_args:
72+
echo "- \${other_args[@]} = ${other_args[@]}"
73+
for i in "${!other_args[@]}"; do
74+
echo "- \${other_args[$i]} = ${other_args[$i]}"
75+
done
76+
fi
6877
}
6978

7079
# :command.command_functions
@@ -160,6 +169,7 @@ initialize() {
160169
# :command.run
161170
run() {
162171
declare -A args
172+
declare -a other_args
163173
parse_requirements "$@"
164174

165175
if [[ $action == "root" ]]; then

examples/default-values/convert

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ inspect_args() {
7575
else
7676
echo args: none
7777
fi
78+
79+
if (( ${#other_args[@]} )); then
80+
echo
81+
echo other_args:
82+
echo "- \${other_args[@]} = ${other_args[@]}"
83+
for i in "${!other_args[@]}"; do
84+
echo "- \${other_args[$i]} = ${other_args[$i]}"
85+
done
86+
fi
7887
}
7988

8089
# :command.command_functions
@@ -160,6 +169,7 @@ initialize() {
160169
# :command.run
161170
run() {
162171
declare -A args
172+
declare -a other_args
163173
parse_requirements "$@"
164174

165175
if [[ $action == "root" ]]; then

examples/dependencies/cli

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,15 @@ inspect_args() {
100100
else
101101
echo args: none
102102
fi
103+
104+
if (( ${#other_args[@]} )); then
105+
echo
106+
echo other_args:
107+
echo "- \${other_args[@]} = ${other_args[@]}"
108+
for i in "${!other_args[@]}"; do
109+
echo "- \${other_args[$i]} = ${other_args[$i]}"
110+
done
111+
fi
103112
}
104113

105114
# :command.command_functions
@@ -304,6 +313,7 @@ initialize() {
304313
# :command.run
305314
run() {
306315
declare -A args
316+
declare -a other_args
307317
parse_requirements "$@"
308318

309319
if [[ $action == "download" ]]; then

0 commit comments

Comments
 (0)