package functoria

  1. Overview
  2. Docs

Functions for reading various options from a command line.

val setup_log : unit Cmdliner.Term.t
val read_full_eval : string array -> bool option

read_full_eval argv reads the --eval option from argv; the return value is None if option is absent in argv.

type 'a describe_args = {
  1. result : 'a;
  2. dotcmd : string;
  3. dot : bool;
  4. output : string option;
}

A value of type describe_args is the result of parsing the arguments to a describe subcommand.

The result field holds the result of parsing the "additional" arguments whose specification is passed as the describe argument to parse_args.

type 'a action =
  1. | Configure of 'a
  2. | Describe of 'a describe_args
  3. | Build of 'a
  4. | Clean of 'a
  5. | Help
    (*

    A value of type action is the result of parsing command-line arguments using parse_args.

    *)
val parse_args : name:string -> version:string -> configure:'a Cmdliner.Term.t -> describe:'a Cmdliner.Term.t -> build:'a Cmdliner.Term.t -> clean:'a Cmdliner.Term.t -> help:_ Cmdliner.Term.t -> string array -> 'a action Cmdliner.Term.result

Parse the functoria command line. The arguments to ~configure, ~describe, etc., describe extra command-line arguments that should be accepted by the corresponding subcommands. The full argument specification is as follows:

name configure -v|--verbose --color=(auto|always|never) extra arguments name describe --eval -v|--verbose --color=(auto|always|never) -o FILE | --output=FILE --dot-command=COMMAND --dot extra arguments name build -v|--verbose --color=(auto|always|never) extra arguments name clean -v|--verbose --color=(auto|always|never) extra arguments name help -v|--verbose --color=(auto|always|never) --man-format=(groff|pager|plain) configure|describe|build|clean|help|topics extra arguments name -v|--verbose --color=(auto|always|never)

There are no side effects, save for the printing of usage messages and other help when either the 'help' subcommand or no subcommand is specified.

OCaml

Innovation. Community. Security.