@@ -4,10 +4,10 @@ discussion: |
4
4
For a longer introduction, see the [Command - line arguments](https://ocaml.org/docs/cli-arguments ) tutorial in the docs.
5
5
The standard library documents the [Arg module ](https://ocaml.org/manual/latest/api/Arg.html ).
6
6
---
7
- (* At the lowest- level we can interact with `Sys.argv` and access arguments by index.
7
+ (* At the lowest level, we can interact with `Sys.argv` and access arguments by index.
8
8
9
9
With this approach all our error checking will have to be entirely manual.
10
- If we pass a non-numeric first argument then `int_of_string` raises an exception.
10
+ If we pass a non-numeric first argument, then `int_of_string` raises an exception.
11
11
A leading dash on our second argument will just be treated as part of the
12
12
name - there is no option handling here.
13
13
*)
@@ -28,16 +28,16 @@ let () =
28
28
interface than `Sys.argv`. It is a good choice for basic command-line
29
29
applications.
30
30
31
- We can handle options with values and repeating positional arguments too.
31
+ We can handle options with values and repeating positional arguments, too.
32
32
It also automatically provides a `--help` option to our application.
33
33
34
34
The `Arg` module is quite imperative and updates references to a value.
35
35
Typically we initialise each option with a default value ("en", 1 etc).
36
36
37
- To handle multiple positional (anonymous) arguments we need a function like
37
+ To handle multiple positional (anonymous) arguments, we need a function like
38
38
`record_anon_arg` to construct a list or otherwise accumulate each item.
39
39
40
- With `speclist` we define the arguments we will parse.
40
+ With `speclist`, we define the arguments we will parse.
41
41
Each argument needs the option-characters themselves, the action that will
42
42
be run when matched and a short explanatory piece of text.
43
43
0 commit comments