package mirage

  1. Overview
  2. Docs

Key defines values that can be set by runtime command-line arguments. This module is the runtime companion of Functoria_key.

Runtime keys

type 'a t

The type for runtime keys containing a value of type 'a.

val create : 'a Arg.t -> 'a t

create conv create a new runtime key.

val get : 'a t -> 'a

get k is the value of the key k. Use the default value if no command-line argument is provided.

  • raises Invalid_argument

    if called before cmdliner's evaluation.

val default : 'a t -> 'a option

default k is the default value of k, if one is available. This function can be called before cmdliner's evaluation.

val term : 'a t -> unit Cmdliner.Term.t

term k is the Cmdliner term whose evaluation sets ks' value to the parsed command-line argument.

OCaml

Innovation. Community. Security.