Command-line arguments: Difference between revisions
Content added Content deleted
m (Improve shell code for calling a lang program) |
m (→Using the Arg module: update link/formatting) |
||
Line 1,810: | Line 1,810: | ||
done</syntaxhighlight> |
done</syntaxhighlight> |
||
=== Using the [ |
=== Using the [https://ocaml.org/api/Arg.html Arg] module === |
||
<syntaxhighlight lang="ocaml">(* default values *) |
<syntaxhighlight lang="ocaml">(* default values *) |
||
let somebool = ref false |
let somebool = ref false |
||
Line 1,831: | Line 1,830: | ||
(fun x -> raise (Arg.Bad ("Bad argument : " ^ x))) |
(fun x -> raise (Arg.Bad ("Bad argument : " ^ x))) |
||
usage; |
usage; |
||
⚫ | |||
<pre> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
--help Display this list of options |
|||
⚫ | |||
⚫ | |||
⚫ | |||
;;</syntaxhighlight> |
|||
$ ocaml arg.ml |
|||
false 0 '' |
|||
⚫ | |||
</pre> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
false 0 <nowiki>''</nowiki> |
|||
=={{header|Odin}}== |
=={{header|Odin}}== |