File: Stdlib.Arg.html

package info (click to toggle)
ocaml-doc 4.11-2
  • links: PTS, VCS
  • area: non-free
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 20,580 kB
  • sloc: sh: 37; makefile: 11
file content (481 lines) | stat: -rw-r--r-- 30,416 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Stdlib.LargeFile.html">
<link rel="next" href="Stdlib.Array.html">
<link rel="Up" href="Stdlib.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><title>Stdlib.Arg</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Stdlib.LargeFile.html" title="Stdlib.LargeFile">Previous</a>
&nbsp;<a class="up" href="Stdlib.html" title="Stdlib">Up</a>
&nbsp;<a class="post" href="Stdlib.Array.html" title="Stdlib.Array">Next</a>
</div>
<h1>Module <a href="type_Stdlib.Arg.html">Stdlib.Arg</a></h1>

<pre><span id="MODULEArg"><span class="keyword">module</span> Arg</span>: <code class="type"><a href="Arg.html">Arg</a></code></pre><hr width="100%">

<pre><code><span id="TYPEspec"><span class="keyword">type</span> <code class="type"></code>spec</span> = </code></pre><table class="typetable">
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Unit"><span class="constructor">Unit</span></span> <span class="keyword">of</span> <code class="type">(unit -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Call the function with unit argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Bool"><span class="constructor">Bool</span></span> <span class="keyword">of</span> <code class="type">(bool -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Call the function with a bool argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Set"><span class="constructor">Set</span></span> <span class="keyword">of</span> <code class="type">bool <a href="Stdlib.html#TYPEref">ref</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Set the reference to true</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Clear"><span class="constructor">Clear</span></span> <span class="keyword">of</span> <code class="type">bool <a href="Stdlib.html#TYPEref">ref</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Set the reference to false</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.String"><span class="constructor">String</span></span> <span class="keyword">of</span> <code class="type">(string -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Call the function with a string argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Set_string"><span class="constructor">Set_string</span></span> <span class="keyword">of</span> <code class="type">string <a href="Stdlib.html#TYPEref">ref</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Set the reference to the string argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Int"><span class="constructor">Int</span></span> <span class="keyword">of</span> <code class="type">(int -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Call the function with an int argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Set_int"><span class="constructor">Set_int</span></span> <span class="keyword">of</span> <code class="type">int <a href="Stdlib.html#TYPEref">ref</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Set the reference to the int argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Float"><span class="constructor">Float</span></span> <span class="keyword">of</span> <code class="type">(float -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Call the function with a float argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Set_float"><span class="constructor">Set_float</span></span> <span class="keyword">of</span> <code class="type">float <a href="Stdlib.html#TYPEref">ref</a></code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Set the reference to the float argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Tuple"><span class="constructor">Tuple</span></span> <span class="keyword">of</span> <code class="type"><a href="Arg.html#TYPEspec">spec</a> list</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Take several arguments according to the
                                   spec list</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Symbol"><span class="constructor">Symbol</span></span> <span class="keyword">of</span> <code class="type">string list * (string -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Take one of the symbols as argument and
                                   call the function with the symbol</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Rest"><span class="constructor">Rest</span></span> <span class="keyword">of</span> <code class="type">(string -> unit)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>Stop interpreting keywords and call the
                                   function with each remaining argument</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr>
<tr>
<td align="left" valign="top" >
<code><span class="keyword">|</span></code></td>
<td align="left" valign="top" >
<code><span id="TYPEELTspec.Expand"><span class="constructor">Expand</span></span> <span class="keyword">of</span> <code class="type">(string -> string array)</code></code></td>
<td class="typefieldcomment" align="left" valign="top" ><code>(*</code></td><td class="typefieldcomment" align="left" valign="top" ><div class="info ">
<div class="info-desc">
<p>If the remaining arguments to process
                                           are of the form
                                           <code class="code">[<span class="string">"-foo"</span>;&nbsp;<span class="string">"arg"</span>]&nbsp;@&nbsp;rest</code> where "foo"
                                           is registered as <code class="code"><span class="constructor">Expand</span>&nbsp;f</code>, then the
                                           arguments <code class="code">f&nbsp;<span class="string">"arg"</span>&nbsp;@&nbsp;rest</code> are
                                           processed. Only allowed in
                                           <code class="code">parse_and_expand_argv_dynamic</code>.</p>
</div>
</div>
</td><td class="typefieldcomment" align="left" valign="bottom" ><code>*)</code></td>
</tr></table>

<div class="info ">
<div class="info-desc">
<p>The concrete type describing the behavior associated
   with a keyword.</p>
</div>
</div>


<pre><span id="TYPEkey"><span class="keyword">type</span> <code class="type"></code>key</span> = <code class="type">string</code> </pre>


<pre><span id="TYPEdoc"><span class="keyword">type</span> <code class="type"></code>doc</span> = <code class="type">string</code> </pre>


<pre><span id="TYPEusage_msg"><span class="keyword">type</span> <code class="type"></code>usage_msg</span> = <code class="type">string</code> </pre>


<pre><span id="TYPEanon_fun"><span class="keyword">type</span> <code class="type"></code>anon_fun</span> = <code class="type">string -> unit</code> </pre>


<pre><span id="VALparse"><span class="keyword">val</span> parse</span> : <code class="type">(<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Arg</span>.parse&nbsp;speclist&nbsp;anon_fun&nbsp;usage_msg</code> parses the command line.
    <code class="code">speclist</code> is a list of triples <code class="code">(key,&nbsp;spec,&nbsp;doc)</code>.
    <code class="code">key</code> is the option keyword, it must start with a <code class="code"><span class="string">'-'</span></code> character.
    <code class="code">spec</code> gives the option type and the function to call when this option
    is found on the command line.
    <code class="code">doc</code> is a one-line description of this option.
    <code class="code">anon_fun</code> is called on anonymous arguments.
    The functions in <code class="code">spec</code> and <code class="code">anon_fun</code> are called in the same order
    as their arguments appear on the command line.</p>

<p>If an error occurs, <code class="code"><span class="constructor">Arg</span>.parse</code> exits the program, after printing
    to standard error an error message as follows:</p>
<ul>
<li>  The reason for the error: unknown option, invalid or missing argument, etc.</li>
<li>  <code class="code">usage_msg</code></li>
<li>  The list of options, each followed by the corresponding <code class="code">doc</code> string.
    Beware: options that have an empty <code class="code">doc</code> string will not be included in the
    list.</li>
</ul>
<p>For the user to be able to specify anonymous arguments starting with a
    <code class="code">-</code>, include for example <code class="code">(<span class="string">"-"</span>,&nbsp;<span class="constructor">String</span>&nbsp;anon_fun,&nbsp;doc)</code> in <code class="code">speclist</code>.</p>

<p>By default, <code class="code">parse</code> recognizes two unit options, <code class="code">-help</code> and <code class="code">--help</code>,
    which will print to standard output <code class="code">usage_msg</code> and the list of
    options, and exit the program.  You can override this behaviour
    by specifying your own <code class="code">-help</code> and <code class="code">--help</code> options in <code class="code">speclist</code>.</p>
</div>
</div>

<pre><span id="VALparse_dynamic"><span class="keyword">val</span> parse_dynamic</span> : <code class="type">(<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list <a href="Stdlib.html#TYPEref">ref</a> -><br>       <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a>, except that the <code class="code">speclist</code> argument is a reference
    and may be updated during the parsing. A typical use for this feature
    is to parse command lines of the form:</p>
<ul>
<li>    command subcommand <code class="code">options</code>
    where the list of options depends on the value of the subcommand argument.</li>
</ul>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALparse_argv"><span class="keyword">val</span> parse_argv</span> : <code class="type">?current:int <a href="Stdlib.html#TYPEref">ref</a> -><br>       string array -><br>       (<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Arg</span>.parse_argv&nbsp;~current&nbsp;args&nbsp;speclist&nbsp;anon_fun&nbsp;usage_msg</code> parses
  the array <code class="code">args</code> as if it were the command line.  It uses and updates
  the value of <code class="code">~current</code> (if given), or <a href="Arg.html#VALcurrent"><code class="code"><span class="constructor">Arg</span>.current</code></a>.  You must set
  it before calling <code class="code">parse_argv</code>.  The initial value of <code class="code">current</code>
  is the index of the program name (argument 0) in the array.
  If an error occurs, <code class="code"><span class="constructor">Arg</span>.parse_argv</code> raises <a href="Arg.html#EXCEPTIONBad"><code class="code"><span class="constructor">Arg</span>.<span class="constructor">Bad</span></code></a> with
  the error message as argument.  If option <code class="code">-help</code> or <code class="code">--help</code> is
  given, <code class="code"><span class="constructor">Arg</span>.parse_argv</code> raises <a href="Arg.html#EXCEPTIONHelp"><code class="code"><span class="constructor">Arg</span>.<span class="constructor">Help</span></code></a> with the help message
  as argument.</p>
</div>
</div>

<pre><span id="VALparse_argv_dynamic"><span class="keyword">val</span> parse_argv_dynamic</span> : <code class="type">?current:int <a href="Stdlib.html#TYPEref">ref</a> -><br>       string array -><br>       (<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list <a href="Stdlib.html#TYPEref">ref</a> -><br>       <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Arg.html#VALparse_argv"><code class="code"><span class="constructor">Arg</span>.parse_argv</code></a>, except that the <code class="code">speclist</code> argument is a
    reference and may be updated during the parsing.
    See <a href="Arg.html#VALparse_dynamic"><code class="code"><span class="constructor">Arg</span>.parse_dynamic</code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.01.0</li>
</ul>
</div>

<pre><span id="VALparse_and_expand_argv_dynamic"><span class="keyword">val</span> parse_and_expand_argv_dynamic</span> : <code class="type">int <a href="Stdlib.html#TYPEref">ref</a> -><br>       string array <a href="Stdlib.html#TYPEref">ref</a> -><br>       (<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list <a href="Stdlib.html#TYPEref">ref</a> -><br>       <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> string -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Arg.html#VALparse_argv_dynamic"><code class="code"><span class="constructor">Arg</span>.parse_argv_dynamic</code></a>, except that the <code class="code">argv</code> argument is a
    reference and may be updated during the parsing of <code class="code"><span class="constructor">Expand</span></code> arguments.
    See <a href="Arg.html#VALparse_argv_dynamic"><code class="code"><span class="constructor">Arg</span>.parse_argv_dynamic</code></a>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="VALparse_expand"><span class="keyword">val</span> parse_expand</span> : <code class="type">(<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> <a href="Arg.html#TYPEanon_fun">anon_fun</a> -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a>, except that the <code class="code"><span class="constructor">Expand</span></code> arguments are allowed and
    the <a href="Arg.html#VALcurrent"><code class="code"><span class="constructor">Arg</span>.current</code></a> reference is not updated.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="EXCEPTIONHelp"><span class="keyword">exception</span> Help</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Raised by <code class="code"><span class="constructor">Arg</span>.parse_argv</code> when the user asks for help.</p>
</div>
</div>

<pre><span id="EXCEPTIONBad"><span class="keyword">exception</span> Bad</span> <span class="keyword">of</span> <code class="type">string</code></pre>
<div class="info ">
<div class="info-desc">
<p>Functions in <code class="code">spec</code> or <code class="code">anon_fun</code> can raise <code class="code"><span class="constructor">Arg</span>.<span class="constructor">Bad</span></code> with an error
    message to reject invalid arguments.
    <code class="code"><span class="constructor">Arg</span>.<span class="constructor">Bad</span></code> is also raised by <a href="Arg.html#VALparse_argv"><code class="code"><span class="constructor">Arg</span>.parse_argv</code></a> in case of an error.</p>
</div>
</div>

<pre><span id="VALusage"><span class="keyword">val</span> usage</span> : <code class="type">(<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Arg</span>.usage&nbsp;speclist&nbsp;usage_msg</code> prints to standard error
    an error message that includes the list of valid options.  This is
    the same message that <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a> prints in case of error.
    <code class="code">speclist</code> and <code class="code">usage_msg</code> are the same as for <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a>.</p>
</div>
</div>

<pre><span id="VALusage_string"><span class="keyword">val</span> usage_string</span> : <code class="type">(<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> <a href="Arg.html#TYPEusage_msg">usage_msg</a> -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Returns the message that would have been printed by <a href="Arg.html#VALusage"><code class="code"><span class="constructor">Arg</span>.usage</code></a>,
    if provided with the same parameters.</p>
</div>
</div>

<pre><span id="VALalign"><span class="keyword">val</span> align</span> : <code class="type">?limit:int -><br>       (<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list -> (<a href="Arg.html#TYPEkey">key</a> * <a href="Arg.html#TYPEspec">spec</a> * <a href="Arg.html#TYPEdoc">doc</a>) list</code></pre><div class="info ">
<div class="info-desc">
<p>Align the documentation strings by inserting spaces at the first alignment
    separator (tab or, if tab is not found, space), according to the length of
    the keyword.  Use a alignment separator as the first character in a doc
    string if you want to align the whole string.  The doc strings corresponding
    to <code class="code"><span class="constructor">Symbol</span></code> arguments are aligned on the next line.</p>
</div>
</div>
<div class="param_info"><code class="code">limit</code> : options with keyword and message longer than <code class="code">limit</code> will not
    be used to compute the alignment.</div>

<pre><span id="VALcurrent"><span class="keyword">val</span> current</span> : <code class="type">int <a href="Stdlib.html#TYPEref">ref</a></code></pre><div class="info ">
<div class="info-desc">
<p>Position (in <a href="Sys.html#VALargv"><code class="code"><span class="constructor">Sys</span>.argv</code></a>) of the argument being processed.  You can
    change this value, e.g. to force <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a> to skip some arguments.
    <a href="Arg.html#VALparse"><code class="code"><span class="constructor">Arg</span>.parse</code></a> uses the initial value of <a href="Arg.html#VALcurrent"><code class="code"><span class="constructor">Arg</span>.current</code></a> as the index of
    argument 0 (the program name) and starts parsing arguments
    at the next element.</p>
</div>
</div>

<pre><span id="VALread_arg"><span class="keyword">val</span> read_arg</span> : <code class="type">string -> string array</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Arg</span>.read_arg&nbsp;file</code> reads newline-terminated command line arguments from
    file <code class="code">file</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="VALread_arg0"><span class="keyword">val</span> read_arg0</span> : <code class="type">string -> string array</code></pre><div class="info ">
<div class="info-desc">
<p>Identical to <a href="Arg.html#VALread_arg"><code class="code"><span class="constructor">Arg</span>.read_arg</code></a> but assumes null character terminated command
    line arguments.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="VALwrite_arg"><span class="keyword">val</span> write_arg</span> : <code class="type">string -> string array -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Arg</span>.write_arg&nbsp;file&nbsp;args</code> writes the arguments <code class="code">args</code> newline-terminated
    into the file <code class="code">file</code>. If the any of the arguments in <code class="code">args</code> contains a
    newline, use <a href="Arg.html#VALwrite_arg0"><code class="code"><span class="constructor">Arg</span>.write_arg0</code></a> instead.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>

<pre><span id="VALwrite_arg0"><span class="keyword">val</span> write_arg0</span> : <code class="type">string -> string array -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Identical to <a href="Arg.html#VALwrite_arg"><code class="code"><span class="constructor">Arg</span>.write_arg</code></a> but uses the null character for terminator
    instead of newline.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05.0</li>
</ul>
</div>
</body></html>