package cmdlang
Declarative Command-line Parsing for OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
cmdlang-0.0.9.tbz
sha256=44fc0027cc27a8d6b511bbde81b0d31306ec1a3d599476d5bd058510f39e87ef
sha512=e1a18905ff6035eb4c44aed71df0e3d42b8277db9a6e98fe571a3b17428c9ef0a26006cb27b729a60208a8357398decc6a8601caca74dabd2e6de7636bc60b31
doc/src/cmdlang.ast/ast.ml.html
Source file ast.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
type 'a or_error_msg = ('a, [ `Msg of string ]) result type 'a parse = string -> 'a or_error_msg type 'a print = Format.formatter -> 'a -> unit module Nonempty_list = struct type 'a t = ( :: ) : 'a * 'a list -> 'a t end module Param = struct type 'a t = | Conv : { docv : string option ; parse : 'a parse ; print : 'a print } -> 'a t | String : string t | Int : int t | Float : float t | Bool : bool t | File : string t | Enum : { docv : string option ; choices : (string * 'a) Nonempty_list.t ; to_string : 'a -> string } -> 'a t | Comma_separated : 'a t -> 'a list t end module Arg = struct type 'a t = | Return : 'a -> 'a t | Map : { x : 'a t ; f : 'a -> 'b } -> 'b t | Both : 'a t * 'b t -> ('a * 'b) t | Apply : { f : ('a -> 'b) t ; x : 'a t } -> 'b t | Flag : { names : string Nonempty_list.t ; doc : string } -> bool t | Flag_count : { names : string Nonempty_list.t ; doc : string } -> int t | Named : { names : string Nonempty_list.t ; param : 'a Param.t ; docv : string option ; doc : string } -> 'a t | Named_multi : { names : string Nonempty_list.t ; param : 'a Param.t ; docv : string option ; doc : string } -> 'a list t | Named_opt : { names : string Nonempty_list.t ; param : 'a Param.t ; docv : string option ; doc : string } -> 'a option t | Named_with_default : { names : string Nonempty_list.t ; param : 'a Param.t ; default : 'a ; docv : string option ; doc : string } -> 'a t | Pos : { pos : int ; param : 'a Param.t ; docv : string option ; doc : string } -> 'a t | Pos_opt : { pos : int ; param : 'a Param.t ; docv : string option ; doc : string } -> 'a option t | Pos_with_default : { pos : int ; param : 'a Param.t ; default : 'a ; docv : string option ; doc : string } -> 'a t | Pos_all : { param : 'a Param.t ; docv : string option ; doc : string } -> 'a list t end module Command = struct type 'a t = | Make : { arg : 'a Arg.t ; summary : string ; readme : (unit -> string) option } -> 'a t | Group : { default : 'a Arg.t option ; summary : string ; readme : (unit -> string) option ; subcommands : (string * 'a t) list } -> 'a t let summary = function | Make { summary; _ } -> summary | Group { summary; _ } -> summary ;; let rec map : type a b. a t -> f:(a -> b) -> b t = fun a ~f -> match a with | Make { arg; summary; readme } -> Make { arg = Arg.Map { x = arg; f }; summary; readme } | Group { default; summary; readme; subcommands } -> Group { default = default |> Option.map (fun arg -> Arg.Map { x = arg; f }) ; summary ; readme ; subcommands = subcommands |> List.map (fun (name, arg) -> name, map arg ~f) } ;; end
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>