package core_kernel
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=fd2b8c6715794df7a810a62b226f53720f211cd344b4afc9fab0498796d6b466
doc/core_kernel.enum/Enum/index.html
Module Enum
Source
Map a constructor name to a command-line string: downcase the name and convert _
to -
.
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_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_comma_separated :
?allow_empty:Base.bool ->
?strip_whitespace:Base.bool ->
?unique_values:Base.bool ->
('a, 'a Base.list Base.option) 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
Transform a string to be accepted by Command
. This is the transformation that is applied throughout this module.
The transformations are:
- Single quotes get removed (since it's annoying to have to quote them when running commands manually)
- Underscores get turned into dashes (just to hopefully have a uniform convention between the two)
- 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.
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.
Defines to_string
for M
, based on M.sexp_of_t
. The sexp representation of M.t
must be a sexp atom.