Skip to content

Commit 2713033

Browse files
committed
rename parse_args to parse_requirements
since it now also filters required env vars
1 parent 1072af7 commit 2713033

File tree

16 files changed

+131
-131
lines changed

16 files changed

+131
-131
lines changed

examples/colors/colorly

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ cyan_underlined() { echo -e "\e[4;36m$*\e[0m" ; }
9999

100100
# :command.command_functions
101101

102-
# :command.parse_args
103-
parse_args() {
102+
# :command.parse_requirements
103+
parse_requirements() {
104104
# :command.environment_variables_filter
105105
# :command.fixed_flag_filter
106106
case "$1" in
@@ -120,7 +120,7 @@ parse_args() {
120120
action="root"
121121
# :command.required_args_filter
122122
# :command.required_flags_filter
123-
# :command.parse_args_while
123+
# :command.parse_requirements_while
124124
while [[ $# -gt 0 ]]; do
125125
key="$1"
126126
case "$key" in
@@ -131,7 +131,7 @@ parse_args() {
131131
;;
132132

133133
* )
134-
# :command.parse_args_case
134+
# :command.parse_requirements_case
135135
if [[ ! ${args[message]} ]]; then
136136
args[message]=$1
137137
shift
@@ -163,7 +163,7 @@ initialize() {
163163
# :command.run
164164
run() {
165165
declare -A args
166-
parse_args "$@"
166+
parse_requirements "$@"
167167

168168
if [[ ${args[--version]} ]]; then
169169
version_command

examples/config-ini/configly

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ configly_list_command() {
274274
config_show
275275
}
276276

277-
# :command.parse_args
278-
parse_args() {
277+
# :command.parse_requirements
278+
parse_requirements() {
279279
# :command.environment_variables_filter
280280
# :command.fixed_flag_filter
281281
case "$1" in
@@ -301,21 +301,21 @@ parse_args() {
301301
set | s )
302302
action="set"
303303
shift
304-
configly_set_parse_args "$@"
304+
configly_set_parse_requirements "$@"
305305
shift $#
306306
;;
307307

308308
get | g )
309309
action="get"
310310
shift
311-
configly_get_parse_args "$@"
311+
configly_get_parse_requirements "$@"
312312
shift $#
313313
;;
314314

315315
list | l )
316316
action="list"
317317
shift
318-
configly_list_parse_args "$@"
318+
configly_list_parse_requirements "$@"
319319
shift $#
320320
;;
321321

@@ -327,7 +327,7 @@ parse_args() {
327327
esac
328328
# :command.required_args_filter
329329
# :command.required_flags_filter
330-
# :command.parse_args_while
330+
# :command.parse_requirements_while
331331
while [[ $# -gt 0 ]]; do
332332
key="$1"
333333
case "$key" in
@@ -338,7 +338,7 @@ parse_args() {
338338
;;
339339

340340
* )
341-
# :command.parse_args_case
341+
# :command.parse_requirements_case
342342
echo -e "invalid argument: $key"
343343
exit 1
344344
;;
@@ -347,8 +347,8 @@ parse_args() {
347347
done
348348
}
349349

350-
# :command.parse_args
351-
configly_set_parse_args() {
350+
# :command.parse_requirements
351+
configly_set_parse_requirements() {
352352
# :command.environment_variables_filter
353353
# :command.fixed_flag_filter
354354
case "$1" in
@@ -383,7 +383,7 @@ configly_set_parse_args() {
383383
exit 1
384384
fi
385385
# :command.required_flags_filter
386-
# :command.parse_args_while
386+
# :command.parse_requirements_while
387387
while [[ $# -gt 0 ]]; do
388388
key="$1"
389389
case "$key" in
@@ -394,7 +394,7 @@ configly_set_parse_args() {
394394
;;
395395

396396
* )
397-
# :command.parse_args_case
397+
# :command.parse_requirements_case
398398
if [[ ! ${args[key]} ]]; then
399399
args[key]=$1
400400
shift
@@ -411,8 +411,8 @@ configly_set_parse_args() {
411411
done
412412
}
413413

414-
# :command.parse_args
415-
configly_get_parse_args() {
414+
# :command.parse_requirements
415+
configly_get_parse_requirements() {
416416
# :command.environment_variables_filter
417417
# :command.fixed_flag_filter
418418
case "$1" in
@@ -439,7 +439,7 @@ configly_get_parse_args() {
439439
exit 1
440440
fi
441441
# :command.required_flags_filter
442-
# :command.parse_args_while
442+
# :command.parse_requirements_while
443443
while [[ $# -gt 0 ]]; do
444444
key="$1"
445445
case "$key" in
@@ -450,7 +450,7 @@ configly_get_parse_args() {
450450
;;
451451

452452
* )
453-
# :command.parse_args_case
453+
# :command.parse_requirements_case
454454
if [[ ! ${args[key]} ]]; then
455455
args[key]=$1
456456
shift
@@ -464,8 +464,8 @@ configly_get_parse_args() {
464464
done
465465
}
466466

467-
# :command.parse_args
468-
configly_list_parse_args() {
467+
# :command.parse_requirements
468+
configly_list_parse_requirements() {
469469
# :command.environment_variables_filter
470470
# :command.fixed_flag_filter
471471
case "$1" in
@@ -485,7 +485,7 @@ configly_list_parse_args() {
485485
action="list"
486486
# :command.required_args_filter
487487
# :command.required_flags_filter
488-
# :command.parse_args_while
488+
# :command.parse_requirements_while
489489
while [[ $# -gt 0 ]]; do
490490
key="$1"
491491
case "$key" in
@@ -496,7 +496,7 @@ configly_list_parse_args() {
496496
;;
497497

498498
* )
499-
# :command.parse_args_case
499+
# :command.parse_requirements_case
500500
echo -e "invalid argument: $key"
501501
exit 1
502502
;;
@@ -523,7 +523,7 @@ initialize() {
523523
# :command.run
524524
run() {
525525
declare -A args
526-
parse_args "$@"
526+
parse_requirements "$@"
527527

528528
if [[ $action == "set" ]]; then
529529
if [[ ${args[--help]} ]]; then

examples/custom-includes/download

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ my_extra_function() {
7171

7272
# :command.command_functions
7373

74-
# :command.parse_args
75-
parse_args() {
74+
# :command.parse_requirements
75+
parse_requirements() {
7676
# :command.environment_variables_filter
7777
# :command.fixed_flag_filter
7878
case "$1" in
@@ -92,7 +92,7 @@ parse_args() {
9292
action="root"
9393
# :command.required_args_filter
9494
# :command.required_flags_filter
95-
# :command.parse_args_while
95+
# :command.parse_requirements_while
9696
while [[ $# -gt 0 ]]; do
9797
key="$1"
9898
case "$key" in
@@ -103,7 +103,7 @@ parse_args() {
103103
;;
104104

105105
* )
106-
# :command.parse_args_case
106+
# :command.parse_requirements_case
107107
if [[ ! ${args[source]} ]]; then
108108
args[source]=$1
109109
shift
@@ -135,7 +135,7 @@ initialize() {
135135
# :command.run
136136
run() {
137137
declare -A args
138-
parse_args "$@"
138+
parse_requirements "$@"
139139

140140
if [[ ${args[--version]} ]]; then
141141
version_command

examples/custom-strings/download

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ inspect_args() {
6666

6767
# :command.command_functions
6868

69-
# :command.parse_args
70-
parse_args() {
69+
# :command.parse_requirements
70+
parse_requirements() {
7171
# :command.environment_variables_filter
7272
# :command.fixed_flag_filter
7373
case "$1" in
@@ -99,7 +99,7 @@ parse_args() {
9999
echo -e "Yo! you forgot a flag: --out, -o DIR"
100100
exit 1
101101
fi
102-
# :command.parse_args_while
102+
# :command.parse_requirements_while
103103
while [[ $# -gt 0 ]]; do
104104
key="$1"
105105
case "$key" in
@@ -122,7 +122,7 @@ parse_args() {
122122
;;
123123

124124
* )
125-
# :command.parse_args_case
125+
# :command.parse_requirements_case
126126
if [[ ! ${args[source]} ]]; then
127127
args[source]=$1
128128
shift
@@ -154,7 +154,7 @@ initialize() {
154154
# :command.run
155155
run() {
156156
declare -A args
157-
parse_args "$@"
157+
parse_requirements "$@"
158158

159159
if [[ ${args[--version]} ]]; then
160160
version_command

0 commit comments

Comments
 (0)