Advertisement
Guest User

OCaml Arg module triple output

a guest
Jan 8th, 2017
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.71 KB | None | 0 0
  1. open Arg
  2.  
  3. let main () =
  4.   let cmds = [( "-a", Arg.String (fun str -> ()), "do stuff") ] in
  5.   Arg.parse cmds (fun str -> ()) "UsageMsg"
  6.  
  7. let () = main ()
  8.  
  9.  
  10. (* generates this output:
  11.  
  12. $ ocamlbuild my_prog.native; ./my_prog.native -a
  13. Finished, 4 targets (0 cached) in 00:00:00.
  14. ./my_prog.native: option '-a' needs an argument.
  15. UsageMsg
  16.   -a do stuff
  17.   -help  Display this list of options
  18.   --help  Display this list of options
  19. ./my_prog.native: ./my_prog.native: option '-a' needs an argument.
  20. UsageMsg
  21.   -a do stuff
  22.   -help  Display this list of options
  23.   --help  Display this list of options
  24. .
  25. UsageMsg
  26.   -a do stuff
  27.   -help  Display this list of options
  28.   --help  Display this list of options
  29.  
  30.  
  31. *)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement