-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.ml
More file actions
26 lines (22 loc) · 774 Bytes
/
test.ml
File metadata and controls
26 lines (22 loc) · 774 Bytes
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
open Printf
module CLI = Minicli.CLI
let main () =
let argc, args = CLI.init () in
if argc = 1 then
(printf "usage:\n\
%s {-i|--input} <file> {-o|--output} <file> -n <int> -x <float> \
[-v] [--hi <string>]\n" Sys.argv.(0);
exit 1);
let input_fn = CLI.get_string ["-i";"--input"] args in
let output_fn = CLI.get_string ["-o"] args in
let n = CLI.get_int ["-n"] args in
let x = CLI.get_float ["-x"] args in
let verbose = CLI.get_set_bool ["-v"] args in
let maybe_say_hi = CLI.get_string_opt ["--hi"] args in
CLI.finalize ();
printf "i: %s o: %s n: %d x: %f v: %s\n"
input_fn output_fn n x (string_of_bool verbose);
match maybe_say_hi with
| None -> ()
| Some name -> printf "Hi %s!\n" name
let () = main ()