package ez_cmdliner

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
module V1 : sig ... end
module V2 : sig ... end

Easy interface over Cmdliner. Very similar to the Stdlib Arg module.

include module type of struct include V1.Ezcmd end
module TYPES = V1.Ezcmd.TYPES
module MANPAGE = V1.Ezcmd.MANPAGE
val parse : ?name:string -> ?version:string -> ?man:TYPES.block list -> (string * TYPES.Arg.spec * string) list -> (string -> unit) -> string -> unit
val translate : ?docs:string -> (string * TYPES.Arg.spec * string) list -> (string list * TYPES.Arg.spec * TYPES.info) list
val translate_anon : (string -> unit) -> (string list * TYPES.Arg.spec * TYPES.info) list
val env : ?docs:string -> ?doc:string -> string -> TYPES.env

env ~docs ~doc var describes an environment variable var. doc is the man page information of the environment variable, defaults to "undocumented". docs is the title of the man page section in which the environment variable will be listed, it defaults to Manpage.s_environment.

In doc the documentation markup language can be used with following variables:

  • $(env), the value of var.
  • The variables mentioned in info
val info : ?docs:string -> ?docv:string -> ?env:TYPES.env -> string -> TYPES.info

info docs docv env doc defines information for an argument.

  • env defines the name of an environment variable which is looked up for defining the argument if it is absent from the command line. See environment variables for details.
  • doc is the man page information of the argument. The documentation language can be used and the following variables are recognized:

    • "$(docv)" the value of docv (see below).
    • "$(opt)", one of the options of names, preference is given to a long one.
    • "$(env)", the environment var specified by env (if any).

    These functions can help with formatting argument values.

  • docv is for positional and non-flag optional arguments. It is a variable name used in the man page to stand for their value.
  • docs is the title of the man page section in which the argument will be listed. For optional arguments this defaults to Manpage.s_options. For positional arguments this defaults to Manpage.s_arguments. However a positional argument is only listed if it has both a doc and docv specified.
val main_with_subcommands : name:string -> ?version:string -> ?default:TYPES.command -> doc:string -> ?man:TYPES.block list -> ?topics:(string * Cmdliner.Manpage.block list) list -> ?argv:string array -> TYPES.command list -> unit
val main : ?version:string -> ?argv:string array -> TYPES.command -> unit
OCaml

Innovation. Community. Security.