View on GitHub


Documenting everything about OCaml


Command Line Arguments

  • The standard library contains the Arg module, which has a simple syntax for defining command line arguments. However, it uses mutable state for arguments, and doesn’t have a built-in way to handle things such as sub-arguments, or argument aliases (long and short) for the same command, though these things can be done.
  • Cmdliner is a declarative approach to laying out command-line arguments. The library uses combinators to build up the desired arguments.
  • ez_cmdliner: Simpler interface on top of Cmdliner.
  • BOS - Basic OS Interaction is a general OS abstraction library which also contains a command line argument module (BOS.OS.Arg).
  • Jane Street’s Core standard library contains the Command module, which takes a similar approach to Cmdliner.
  • Minicli is a self-described minimalist library for command line parsing.
  • Quick-and-dirty pure command-line arguments in OCaml (using the standard Library’s Arg module)