package ez_cmdliner

  1. Overview
  2. Docs

This is the main function. It will dispatch on the subcommand called by the user.

It takes a list of subcommands, defined for example with:

open Ezcmd.V2

let cmd =
  let files = ref [] in
  EZCMD.sub
    "parse this file"
    (fun () ->
     ... (* action to perform after parsing options *)
    )
    ~args:
      [
        [ "a"; "after" ],
        EZCMD.String (fun s -> ... ),
        EZCMD.info ~docv:"STRING" "I use this string";

        [],
        EZCMD.Anons (fun args -> ... ),
        EZCMD.info ~docv:"FILE" "I use these arguments" ;
      ]
    ~doc: "..."
    ~man:[
      `S "DESCRIPTION";
      `Blocks [
        `P "..."
      ];
    ]

let () = main [ cmd ]

default options: -v | --verbose : increase verbosity and backtraces -q | --quiet : set verbosity to 0 --version : print M.version --about : print M.about --echo : print command with current arguments rst : output a .rst file with all subcommands

Parameters

module M : sig ... end

Signature

val main : ?on_error:(unit -> unit) -> ?print_config:(unit -> unit) -> TYPES.sub list -> unit
OCaml

Innovation. Community. Security.