@@ -28,12 +28,11 @@ flags:
2828 short : -d
2929 arg : data
3030 help : Provide data values
31- required : true
3231
3332 # Setting this to true on a flag with an argument means the user can type it
3433 # multiple times, like --data a --data b.
3534 # The argument will be received as a quoted and space-delimited string which
36- # needs to be converted to an array with `eval "data=(${args[--data]})"`
35+ # needs to be converted to an array with `eval "data=(${args[--data]})"`.
3736 repeatable : true
3837
3938- long : --path
@@ -42,9 +41,15 @@ flags:
4241 help : Specify one or more paths
4342 repeatable : true
4443
45- # Setting this to true will ignore repeating arguments that are not unique
44+ # Setting this to true will ignore repeating arguments that are not unique.
4645 unique : true
4746
47+ # Setting default value(s) for a repeatable flag argument should be done in
48+ # an array form.
49+ default :
50+ - file one
51+ - file-two
52+
4853- long : --verbose
4954 short : -v
5055 help : Set verbosity level
@@ -63,7 +68,7 @@ examples:
6368
6469` ` ` ` bash
6570# Convert the space delimited string to an array
66- eval "data=(${args[--data]})"
71+ eval "data=(${args[--data]:- })"
6772
6873echo "Data elements:"
6974for i in "${data[@]}"; do
@@ -94,11 +99,12 @@ Usage:
9499 download --version
95100
96101Options:
97- --data, -d DATA (required) ( repeatable)
102+ --data, -d DATA (repeatable)
98103 Provide data values
99104
100105 --path, -p LOCATION (repeatable)
101106 Specify one or more paths
107+ Default: file one, file-two
102108
103109 --verbose, -v (repeatable)
104110 Set verbosity level
@@ -115,6 +121,19 @@ Examples:
115121
116122
117123
124+ ````
125+
126+ ### ` $ ./download `
127+
128+ ```` shell
129+ Data elements:
130+
131+ Verbosity level: 1
132+
133+ args:
134+ - ${args[--path]} = file\ one file-two
135+
136+
118137````
119138
120139### ` $ ./download -d one -d "two three" -vvv `
@@ -128,6 +147,7 @@ Verbosity level: 3
128147
129148args:
130149- ${args[--data]} = " one" " two three"
150+ - ${args[--path]} = file\ one file-two
131151- ${args[--verbose]} = 3
132152
133153
0 commit comments