package minicli

  1. Overview
  2. Docs
Minimalist library for command line parsing

Install

Dune Dependency

Authors

Maintainers

Sources

v5.0.0.tar.gz
sha256=66833cd577d672db9b580b8db1cdbb59596d66e380a6c6ee6eb2db5f2e4acffb
md5=0aa4a3ce11d9554c755cf75b6ba50237

README.md.html

minicli

Minimalist OCaml library for command line parsing. Look into the test.ml file for usage examples/quickstart.

example session with the test program

# ./test
usage:
./test {-i|--input} <file> {-o|--output} <file> -n <int> -x <float> [-v] [--hi <string>]

# ./test -i
Fatal error: exception CLI.No_param_for_option("-i")

# ./test -i input.txt
Fatal error: exception CLI.Option_is_mandatory("-o")

# ./test -i input.txt -o output.txt
Fatal error: exception CLI.Option_is_mandatory("-n")

# ./test -i input.txt -o output.txt -n /dev/null
Fatal error: exception CLI.Not_an_int("/dev/null")

# ./test -i input.txt -o output.txt -n 123
Fatal error: exception CLI.Option_is_mandatory("-x")

# ./test -i input.txt -o output.txt -n 123 -x /dev/null
Fatal error: exception CLI.Not_a_float("/dev/null")

# ./test -i input.txt -o output.txt -n 123 -x 0.123
i: input.txt o: output.txt n: 123 x: 0.123000 v: false

# ./test -i input.txt -o output.txt -n 123 -x 0.123 -v
i: input.txt o: output.txt n: 123 x: 0.123000 v: true

# ./test -i input.txt -o output.txt -n 123 -x 0.123 -v -i input.bin
Fatal error: exception CLI.More_than_once("-i, --input")
OCaml

Innovation. Community. Security.