Module Functoria_command_line

Functions for reading various options from a command line.

val setup_log : unit Cmdliner.Term.t
val config_file : ( Fpath.t -> unit ) -> unit Cmdliner.Term.t
val build_dir : ( Fpath.t -> unit ) -> unit Cmdliner.Term.t
val output : string option 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 configure_args = {
result : 'a;
output : string option;
}

A value of type configure_args is the result of parsing the arguments of a configure subcommand.

type 'a describe_args = {
result : 'a;
dotcmd : string;
dot : bool;
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 =
| Configure of 'a configure_args
| Describe of 'a describe_args
| Build of 'a
| Clean of 'a
| Help(*

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

*)
val pp_action : 'a Fmt.t -> 'a action Fmt.t

pp_action is the pretty-printer for actions.

val parse_args : ?help_ppf:Stdlib.Format.formatter -> ?err_ppf:Stdlib.Format.formatter -> 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.