You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -184,9 +186,27 @@ The order the arguments are passed on the command line makes a difference
184
186
* Calling `my-script.sh -g 345 -g` will cause `argValue "g"` to return nothing
185
187
* Calling `my-script.sh --size 512 --size=1024` will cause `argValue "size"` to return `1024`
186
188
189
+
## Passing Additional Non-Arguments Strings
190
+
191
+
If you need to pass in non-argument stings along side your arguments you just need to add the end of arguments marker `--` and anything that follows wont be parsed as an argument but instead will be assigned to a numbered positional argument:
192
+
193
+
For example running: `./script.sh --arg1 --arg2 -- file1 file2 -f file5 fileN`
194
+
195
+
Will be parsed as:
196
+
197
+
* Argument: `--arg1`
198
+
* Argument: `--arg2`
199
+
* Non-Argument: `file1` (accessible via `$1`)
200
+
* Non-Argument: `file2` (accessible via `$2`)
201
+
* Non-Argument: `-f` (accessible via `$3`)
202
+
* Non-Argument: `file5` (accessible via `$4`)
203
+
* Non-Argument: `fileN` (accessible via `${N}`)
204
+
205
+
This way you can define arguments along side an arbitrary number of strings you may want to operate on at the same time!
206
+
187
207
## Debug Mode
188
208
189
-
There is a debug mode that can be enabled by setting the `ARG_DEBUG` variable to `true` right before calling `argParse`.
209
+
There is a debug mode that can be enabled by setting the `ARG_DEBUG` variable to `true` right before including the library.
190
210
This will cause the script to dump out information about which flags it finds and of what kind etc
0 commit comments