File tree Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Expand file tree Collapse file tree 1 file changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -217,7 +217,39 @@ const args = {
217
217
}
218
218
```
219
219
220
- #### Errors
220
+ #### ` stopAtPositional `
221
+
222
+ When ` stopAtPositional ` is set to ` true ` , ` arg ` will halt parsing at the first
223
+ positional argument.
224
+
225
+ For example:
226
+
227
+ ``` javascript
228
+ const arg = require (' arg' );
229
+
230
+ const argv = [' --foo' , ' hello' , ' --bar' ];
231
+
232
+ const args = arg (
233
+ {
234
+ ' --foo' : Boolean ,
235
+ ' --bar' : Boolean
236
+ }, {
237
+ argv,
238
+ stopAtPositional: true
239
+ }
240
+ );
241
+ ```
242
+
243
+ results in:
244
+
245
+ ``` javascript
246
+ const args = {
247
+ _: [' hello' , ' --bar' ],
248
+ ' --foo' : true
249
+ };
250
+ ```
251
+
252
+ ### Errors
221
253
222
254
Some errors that ` arg ` throws provide a ` .code ` property in order to aid in recovering from user error, or to
223
255
differentiate between user error and developer error (bug).
You can’t perform that action at this time.
0 commit comments