Skip to content

Instantly share code, notes, and snippets.

@leostera
Created February 11, 2021 11:38
Show Gist options
  • Save leostera/8236972fe076d3cce5c7fcbef025b566 to your computer and use it in GitHub Desktop.
Save leostera/8236972fe076d3cce5c7fcbef025b566 to your computer and use it in GitHub Desktop.
open Cmdliner
(* our echo function just prints stuff out *)
let echo x = print_string x
(* this is our argument *)
let msg = Arg.(value & pos 0 string "" & info [])
(* this is our program *)
let echo_t = Term.(const echo $ msg)
let () = Term.exit @@ Term.eval (echo_t, Term.info "echo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment