Last active
December 7, 2019 02:55
-
-
Save mjambon/1122b2e335a63a724fabeb464615d775 to your computer and use it in GitHub Desktop.
That feeling when you realize there's no magic in Cmdliner
This file contains hidden or 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
(* | |
Sample command-line argument specified using Cmdliner's author's style. | |
*) | |
open Cmdliner | |
let seed_term = | |
let doc = " | |
Use the number $(docv) to initialize the global pseudo-random number | |
generator. | |
" | |
in | |
Arg.(value & opt (some int) None & info ["seed"] ~docv:"SEED" ~doc) |
This file contains hidden or 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
(* | |
Same command-line argument specification rewritten using a plain style. | |
*) | |
open Cmdliner | |
let seed_term = | |
let doc = " | |
Use the number $(docv) to initialize the global pseudo-random number | |
generator. | |
" | |
in | |
let info = Arg.info ["seed"] ~docv:"SEED" ~doc in | |
let arg = Arg.opt (Arg.some Arg.int) None info in | |
Arg.value arg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment