package core_kernel

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type 'a t = (module S with type t = 'a)
val to_string_hum : 'a t -> 'a -> Base.string

Map a constructor name to a command-line string: downcase the name and convert _ to -.

val check_field_name : 'a t -> 'a -> (_, _, _) Base.Field.t_with_perm -> Base.unit
val enum : 'a t -> (Base.string * 'a) Base.list
val assert_alphabetic_order_exn : Base.Source_code_position.t -> 'a t -> Base.unit
type ('a, 'b) make_param = ?case_sensitive:Base.bool -> ?represent_choice_with:Base.string -> ?list_values_in_help:Base.bool -> ?aliases:Base.string Base.list -> ?key:'a Univ_map.Multi.Key.t -> Base.string -> doc:Base.string -> 'a t -> 'b Command.Param.t
val make_param : f:('a Command.Arg_type.t -> 'b Command.Flag.t) -> ('a, 'b) make_param
val make_param_one_of_flags : ?if_nothing_chosen:('a, 'a) Command.Param.If_nothing_chosen.t -> ?aliases:('a -> Base.string Base.list) -> doc:('a -> Base.string) -> 'a t -> 'a Command.Param.t
val make_param_optional_with_default_doc : default:'a -> ('a, 'a) make_param
val make_param_optional_comma_separated : ?allow_empty:Base.bool -> ?strip_whitespace:Base.bool -> ?unique_values:Base.bool -> ('a, 'a Base.list Base.option) make_param
val make_param_optional_comma_separated_with_default_doc : ?allow_empty:Base.bool -> ?strip_whitespace:Base.bool -> ?unique_values:Base.bool -> default:'a Base.list -> ('a, 'a Base.list) make_param
val arg_type : ?case_sensitive:Base.bool -> ?key:'a Univ_map.Multi.Key.t -> ?list_values_in_help:Base.bool -> 'a t -> 'a Command.Arg_type.t
val command_friendly_name : Base.string -> Base.string

Transform a string to be accepted by Command. This is the transformation that is applied throughout this module.

The transformations are:

  1. Single quotes get removed (since it's annoying to have to quote them when running commands manually)
  2. Underscores get turned into dashes (just to hopefully have a uniform convention between the two)
  3. Other characters get lowercased

Note that this is *not* actually a complete list of transformations needed to make an arbitrary string "command-friendly": for example, double quotes are left alone. This is because the expectation is that the string came from something like a [@@deriving sexp] on a variant type, and while single quotes can appear in ocaml variants, double quotes cannot.

module Make_stringable (M : S) : Base.Stringable.S with type t := M.t

Defines to_string and of_string functions for M, based on M.sexp_of_t and M.all. The sexp representation of M.t must be a sexp atom.

Defines an of_string function for M, using M.all and M.to_string. Does not require M to be sexpable.

module Make_to_string (M : sig ... end) : sig ... end

Defines to_string for M, based on M.sexp_of_t. The sexp representation of M.t must be a sexp atom.

module Single : sig ... end
OCaml

Innovation. Community. Security.