Last active
January 21, 2017 06:16
-
-
Save yawaramin/7abed718bd77056b940a8b0415c8b43e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open Cmdliner | |
let mycli _ _ = print_endline "Success!" | |
let interface = | |
let docv = "INTERFACE" in | |
let doc = "parse AST as an interface (true or false)" in | |
Arg.(required & pos 0 (some bool) None & info ~docv ~doc []) | |
let recoverable = | |
let docv = "RECOVERABLE" in | |
let doc = "enable recoverable parser (true or false)" in | |
Arg.(required & pos 1 (some bool) None & info ~docv ~doc []) | |
let mycli_t = Term.(const mycli $ interface $ recoverable) | |
let top_level_info = | |
let doc = "My simple CLI utility" in | |
let man = | |
[ `S "DESCRIPTION"; | |
`P "mycli is a tiny utility to understand Cmdliner" ] in | |
Term.info "mycli" ~doc ~man | |
let () = | |
match Term.eval (mycli_t, top_level_info) with | |
| `Error _ -> exit 1 | _ -> () |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment