···52525353(* Argument converters *)
54545555-module Completion = Cmdliner_info.Arg.Completion
5656-module Conv = Cmdliner_info.Arg.Conv
5555+module Completion = Cmdliner_info.Arg_completion
5656+module Conv = Cmdliner_info.Arg_conv
5757type 'a conv = 'a Conv.t
5858-let some = Cmdliner_info.Arg.Conv.some
5959-let some' = Cmdliner_info.Arg.Conv.some'
5858+let some = Cmdliner_info.Arg_conv.some
5959+let some' = Cmdliner_info.Arg_conv.some'
60606161(* Argument information *)
6262···66666767(* Arguments *)
68686969-let no_completion = Cmdliner_info.Arg.Set.V Cmdliner_info.Arg.Completion.none
6969+let no_completion =
7070+ Cmdliner_info.Arg.Completion Cmdliner_info.Arg_completion.none
70717172let ( & ) f x = f x
7273let parse_error e = Error (`Parse e)
···202203 | (_, f, _) :: (_, g, _) :: _ ->
203204 parse_error (Cmdliner_msg.err_opt_repeated g f)
204205 in
205205- Cmdliner_term.make (arg_to_args a (V (Conv.completion conv))) convert
206206+ Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert
206207207208let opt_all ?vopt conv v a =
208209 if Cmdliner_info.Arg.is_pos a then invalid_arg err_not_opt else
···231232 (List.sort rev_compare (List.rev_map parse l))) with
232233 | Failure e -> parse_error e
233234 in
234234- Cmdliner_term.make (arg_to_args a (V (Conv.completion conv))) convert
235235+ Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert
235236236237(* Positional arguments *)
237238···257258 | Failure e -> parse_error e)
258259 | _ -> assert false
259260 in
260260- Cmdliner_term.make (arg_to_args a (V (Conv.completion conv))) convert
261261+ Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert
261262262263let pos_list pos conv v a =
263264 if Cmdliner_info.Arg.is_opt a then invalid_arg err_not_pos else
···272273 with
273274 | Failure e -> parse_error e
274275 in
275275- Cmdliner_term.make (arg_to_args a (V (Conv.completion conv))) convert
276276+ Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert
276277277278let all = Cmdliner_info.Arg.pos ~rev:false ~start:0 ~len:None
278279let pos_all c v a = pos_list all c v a
+2
vendor/opam/cmdliner/src/cmdliner_arg.mli
···1515 val make :
1616 ?complete:complete -> ?dirs:bool -> ?files:bool -> ?restart:bool -> unit ->
1717 'a t
1818+1919+ val context : 'a t -> 'a Cmdliner_term.t option
1820 val complete : 'a t -> complete
1921 val dirs : 'a t -> bool
2022 val files : 'a t -> bool
+5-5
vendor/opam/cmdliner/src/cmdliner_completion.ml
···3434 end
35353636let pp_arg_values ~after_dashdash ~prefix ppf comp =
3737- if after_dashdash && Cmdliner_info.Arg.Completion.restart comp
3737+ if after_dashdash && Cmdliner_info.Arg_completion.restart comp
3838 then pp_line ppf "restart" else
3939- let items = Cmdliner_info.Arg.Completion.complete comp prefix in
4040- let comp_files = Cmdliner_info.Arg.Completion.files comp in
4141- let comp_dirs = Cmdliner_info.Arg.Completion.dirs comp in
3939+ let items = Cmdliner_info.Arg_completion.complete comp prefix in
4040+ let comp_files = Cmdliner_info.Arg_completion.files comp in
4141+ let comp_dirs = Cmdliner_info.Arg_completion.dirs comp in
4242 if items <> [] || comp_files || comp_dirs then begin
4343 pp_group ppf "Values";
4444 List.iter (pp_item ppf ~prefix) items;
···6565 let pp_arg_value ppf arg_info =
6666 begin match Cmdliner_info.Arg.Set.find_opt arg_info cmd_args_info with
6767 | None -> ()
6868- | Some (V comp) -> pp_arg_values ~after_dashdash ~prefix ppf comp
6868+ | Some (Completion comp) -> pp_arg_values ~after_dashdash ~prefix ppf comp
6969 end;
7070 in
7171 let pp ppf () =
+174-156
vendor/opam/cmdliner/src/cmdliner_info.ml
···8383(* Arguments *)
84848585module Arg = struct
8686-8787- (* Completions *)
8888-8989- module Completion = struct
9090- type complete = string -> (string * string) list
9191- type 'a t =
9292- { complete : complete;
9393- dirs : bool;
9494- files : bool;
9595- restart : bool }
9696-9797- let make
9898- ?(complete = Fun.const []) ?(dirs = false) ?(files = false)
9999- ?(restart = false) ()
100100- =
101101- {complete; dirs; files; restart}
102102-103103- let none = make ()
104104- let some = (Fun.id :> 'a t -> 'a option t)
105105- let complete c = c.complete
106106- let dirs c = c.dirs
107107- let files c = c.files
108108- let restart c = c.restart
109109- end
110110-111111- (* Converters *)
112112-113113- module Conv = struct
114114- type 'a parser = string -> ('a, string) result
115115- type 'a fmt = Format.formatter -> 'a -> unit
116116- type 'a t =
117117- { docv : string;
118118- parser : 'a parser;
119119- pp : 'a fmt;
120120- completion : 'a Completion.t; }
121121-122122- let make ?(completion = Completion.none) ~docv ~parser ~pp () =
123123- { docv; parser; pp; completion }
124124-125125- let of_conv
126126- conv ?(completion = conv.completion) ?(docv = conv.docv)
127127- ?(parser = conv.parser) ?(pp = conv.pp) ()
128128- =
129129- { docv; parser; pp; completion }
130130-131131- let docv c = c.docv
132132- let parser c = c.parser
133133- let pp c = c.pp
134134- let completion c = c.completion
135135-136136- let some ?(none = "") conv =
137137- let parser s = match parser conv s with
138138- | Ok v -> Ok (Some v) | Error _ as e -> e
139139- in
140140- let pp ppf v = match v with
141141- | None -> Format.pp_print_string ppf none
142142- | Some v -> pp conv ppf v
143143- in
144144- let completion = Completion.some (completion conv) in
145145- { conv with parser; pp; completion }
146146-147147- let some' ?none conv =
148148- let parser s = match parser conv s with
149149- | Ok v -> Ok (Some v) | Error _ as e -> e
150150- in
151151- let pp ppf = function
152152- | None -> (match none with None -> () | Some v -> (pp conv) ppf v)
153153- | Some v -> pp conv ppf v
154154- in
155155- let completion = Completion.some conv.completion in
156156- { conv with parser; pp; completion }
157157- end
158158-15986 type absence = Err | Val of string Lazy.t | Doc of string
16087 type opt_kind = Flag | Opt | Opt_vopt of string
161161-16288 type pos_kind = (* information about a positional argument. *)
16389 { pos_rev : bool; (* if [true] positions are counted from the end. *)
16490 pos_start : int; (* start positional argument. *)
···17096 let pos_rev p = p.pos_rev
17197 let pos_start p = p.pos_start
17298 let pos_len p = p.pos_len
9999+ let dumb_pos = pos ~rev:false ~start:(-1) ~len:None
173100174101 type t = (* information about a command line argument. *)
175102 { id : int; (* unique id for the argument. *)
···184111 opt_kind : opt_kind; (* optional arg kind. *)
185112 opt_names : string list; (* names (for opt args). *)
186113 opt_all : bool; } (* repeatable (for opt args). *)
187187-188188- let dumb_pos = pos ~rev:false ~start:(-1) ~len:None
189114190115 let make
191116 ?deprecated ?(absent = "") ?docs ?(doc_envs = []) ?(docv = "")
···240165 let is_pos i = i.opt_names = []
241166 let is_req i = i.absent = Err
242167243243- let pos_cli_order a0 a1 = (* best-effort order on the cli. *)
244244- let c = compare (a0.pos.pos_rev) (a1.pos.pos_rev) in
168168+ let pos_cli_order (a0 : t) (a1 : t) = (* best-effort order on the cli. *)
169169+ let c = Bool.compare (a0.pos.pos_rev) (a1.pos.pos_rev) in
245170 if c <> 0 then c else
246171 if a0.pos.pos_rev
247247- then compare a1.pos.pos_start a0.pos.pos_start
248248- else compare a0.pos.pos_start a1.pos.pos_start
172172+ then Int.compare a1.pos.pos_start a0.pos.pos_start
173173+ else Int.compare a0.pos.pos_start a1.pos.pos_start
249174250175 let rev_pos_cli_order a0 a1 = pos_cli_order a1 a0
251176252252- let compare a0 a1 = Int.compare a0.id a1.id
253253-254254- let doclang_subst ~subst i = function
177177+ let doclang_subst ~subst (i : t) = function
255178 | "docv" ->
256179 let docv = if i.docv = "" then "VAL" else i.docv in
257180 Some (strf "$(i,%s)" (Cmdliner_manpage.escape docv))
···262185 | Some e -> Env.doclang_subst ~subst e id
263186 | None -> subst id
264187265265- let styled_deprecated ~errs ~subst i = match i.deprecated with
188188+ let styled_deprecated ~errs ~subst (i : t) = match i.deprecated with
266189 | None -> "" | Some msg -> Cmdliner_manpage.doc_to_styled ~errs ~subst msg
267190268268- let styled_doc ~errs ~subst i =
191191+ let styled_doc ~errs ~subst (i : t) =
269192 Cmdliner_manpage.doc_to_styled ~errs ~subst i.doc
270193271271- module T = struct type nonrec t = t let compare = compare end
272272- module Map = Map.Make (T)
273273- module Set = struct
274274- type arg = t
275275- type completion = V : 'a Completion.t -> completion
194194+ let compare (a0 : t) (a1 : t) = Int.compare a0.id a1.id
195195+ module Map = Map.Make (struct type nonrec t = t let compare = compare end)
276196277277- include Map
197197+ (* Due to terms appearing in the completion API, we have an annoying
198198+ recursive type definition which we resolve here. Most of these
199199+ types do not belong this module. *)
278200279279- type t = completion Map.t
201201+ type term_escape =
202202+ [ `Error of bool * string
203203+ | `Help of Cmdliner_manpage.format * string option ]
280204281281- let find_opt k m = try Some (Map.find k m) with Not_found -> None
282282- let elements m = List.map fst (bindings m)
283283- let union a b =
284284- Map.merge (fun k v v' ->
285285- match v, v' with
286286- | Some v, _ | _, Some v -> Some v
287287- | None, None -> assert false) a b
288288- end
289289-end
205205+ type complete = string -> (string * string) list
206206+ type 'a completion =
207207+ { context : 'a term option;
208208+ complete : complete;
209209+ dirs : bool;
210210+ files : bool;
211211+ restart : bool }
290212291291-(* Commands *)
213213+ and e_completion = Completion : 'a completion -> e_completion
214214+ and arg_set = e_completion Map.t
292215293293-module Cmd = struct
294294- type t =
216216+ and cmd =
295217 { name : string; (* name of the cmd. *)
296218 version : string option; (* version (for --version). *)
297219 deprecated : string option; (* deprecation message *)
···302224 envs : Env.info list; (* env vars that influence the cmd. *)
303225 man : Cmdliner_manpage.block list; (* man page text. *)
304226 man_xrefs : Cmdliner_manpage.xref list; (* man cross-refs. *)
305305- args : Arg.Set.t; (* Command arguments. *)
227227+ args : arg_set; (* Command arguments. *)
306228 has_args : bool; (* [true] if has own parsing term. *)
307307- children : t list; } (* Children, if any. *)
229229+ children : cmd list; } (* Children, if any. *)
230230+231231+ and eval = (* information about the evaluation context. *)
232232+ { cmd : cmd; (* cmd being evaluated. *)
233233+ ancestors : cmd list; (* ancestors of cmd, root is last. *)
234234+ env : string -> string option; (* environment variable lookup. *)
235235+ err_ppf : Format.formatter (* error formatter *) }
236236+237237+ and cline = cline_arg Map.t
238238+ and cline_arg = (* unconverted argument data as found on the command line. *)
239239+ | O of (int * string * (string option)) list (* (pos, name, value) of opt. *)
240240+ | P of string list
241241+242242+ and 'a term_parser =
243243+ eval -> cline -> ('a, [ `Parse of string | term_escape ]) result
244244+245245+ and 'a term = arg_set * 'a term_parser
246246+247247+ (* Sets of arguments stored as maps to their completion *)
248248+249249+ module Set = struct
250250+ include Map
251251+ type t = e_completion Map.t
252252+ let find_opt k m = try Some (Map.find k m) with Not_found -> None
253253+ let elements m = List.map fst (bindings m)
254254+ let union a b =
255255+ Map.merge (fun k v v' ->
256256+ match v, v' with
257257+ | Some v, _ | _, Some v -> Some v
258258+ | None, None -> assert false) a b
259259+ end
260260+end
308261262262+(* Commands *)
263263+264264+module Cmd = struct
265265+ type t = Arg.cmd
309266 let make
310267 ?deprecated ?(man_xrefs = [`Main]) ?(man = []) ?(envs = [])
311268 ?(exits = Exit.defaults) ?(sdocs = Cmdliner_manpage.s_common_options)
312312- ?(docs = Cmdliner_manpage.s_commands) ?(doc = "") ?version name
269269+ ?(docs = Cmdliner_manpage.s_commands) ?(doc = "") ?version name : t
313270 =
314271 { name; version; deprecated; doc; docs; sdocs; exits;
315272 envs; man; man_xrefs; args = Arg.Set.empty;
316273 has_args = true; children = [] }
317274318318- let name i = i.name
319319- let version i = i.version
320320- let deprecated i = i.deprecated
321321- let doc i = i.doc
322322- let docs i = i.docs
323323- let stdopts_docs i = i.sdocs
324324- let exits i = i.exits
325325- let envs i = i.envs
326326- let man i = i.man
327327- let man_xrefs i = i.man_xrefs
328328- let args i = i.args
329329- let has_args i = i.has_args
330330- let children i = i.children
331331- let add_args i args = { i with args = Arg.Set.union args i.args }
332332- let with_children cmd ~args ~children =
275275+ let name (i : t) = i.name
276276+ let version (i : t) = i.version
277277+ let deprecated (i : t) = i.deprecated
278278+ let doc (i : t) = i.doc
279279+ let docs (i : t) = i.docs
280280+ let stdopts_docs (i : t) = i.sdocs
281281+ let exits (i : t) = i.exits
282282+ let envs (i : t) = i.envs
283283+ let man (i : t) = i.man
284284+ let man_xrefs (i : t) = i.man_xrefs
285285+ let args (i : t) = i.args
286286+ let has_args (i : t) = i.has_args
287287+ let children (i : t) = i.children
288288+ let add_args (i : t) args = { i with args = Arg.Set.union args i.args }
289289+ let with_children (i : t) ~args ~children =
333290 let has_args, args = match args with
334334- | None -> false, cmd.args
335335- | Some args -> true, Arg.Set.union args cmd.args
291291+ | None -> false, i.args
292292+ | Some args -> true, Arg.Set.union args i.args
336293 in
337337- { cmd with has_args; args; children }
294294+ { i with has_args; args; children }
338295339339- let styled_deprecated ~errs ~subst i = match i.deprecated with
296296+ let styled_deprecated ~errs ~subst (i : t) = match i.deprecated with
340297 | None -> "" | Some msg -> Cmdliner_manpage.doc_to_styled ~errs ~subst msg
341298342342- let styled_doc ~errs ~subst i =
299299+ let styled_doc ~errs ~subst (i : t) =
343300 Cmdliner_manpage.doc_to_styled ~errs ~subst i.doc
344301345345- let escaped_name i = Cmdliner_manpage.escape i.name
302302+ let escaped_name (i : t) = Cmdliner_manpage.escape i.name
346303end
347304348305(* Command lines *)
349306350307module Cline = struct
351351- type arg = (* unconverted argument data as found on the command line. *)
352352- | O of (int * string * (string option)) list (* (pos, name, value) of opt. *)
308308+ type arg = Arg.cline_arg =
309309+ | O of (int * string * (string option)) list
353310 | P of string list
354311355355- type t = arg Arg.Map.t (* command line, maps arg_infos to arg value. *)
312312+ type t = Arg.cline
356313end
357357-358314359315(* Evaluation *)
360316361317module Eval = struct
362362- type t = (* information about the evaluation context. *)
363363- { cmd : Cmd.t; (* cmd being evaluated. *)
364364- ancestors : Cmd.t list; (* ancestors of cmd, root is last. *)
365365- env : string -> string option; (* environment variable lookup. *)
366366- err_ppf : Format.formatter (* error formatter *) }
318318+ type t = Arg.eval
367319368368- let make ~cmd ~ancestors ~env ~err_ppf = { cmd; ancestors; env; err_ppf }
320320+ let make ~cmd ~ancestors ~env ~err_ppf : t = { cmd; ancestors; env; err_ppf }
369321370370- let cmd i = i.cmd
371371- let ancestors i = i.ancestors
372372- let env_var i v = i.env v
373373- let err_ppf i = i.err_ppf
374374- let main i = match List.rev i.ancestors with [] -> i.cmd | m :: _ -> m
375375- let with_cmd i cmd = { i with cmd }
322322+ let cmd (i : t) = i.cmd
323323+ let ancestors (i : t) = i.ancestors
324324+ let env_var (i : t) v = i.env v
325325+ let err_ppf (i : t) = i.err_ppf
326326+ let main (i : t) = match List.rev i.ancestors with [] -> i.cmd | m :: _ -> m
327327+ let with_cmd (i : t) cmd = { i with cmd }
376328377329 let doclang_name n = strf "$(b,%s)" (Cmd.escaped_name n)
378330 let doclang_names names =
379331 strf "$(b,%s)" (Cmdliner_manpage.escape (String.concat " " names))
380332381381- let doclang_subst ei = function
382382- | "tname" | "cmd.name" -> Some (doclang_name ei.cmd)
383383- | "mname" | "tool" -> Some (doclang_name (main ei))
333333+ let doclang_subst (i : t) = function
334334+ | "tname" | "cmd.name" -> Some (doclang_name i.cmd)
335335+ | "mname" | "tool" -> Some (doclang_name (main i))
384336 | "cmd.parent" ->
385385- let ancestors = ancestors ei in
386386- if ancestors = [] then Some (doclang_name (main ei)) else
337337+ let ancestors = ancestors i in
338338+ if ancestors = [] then Some (doclang_name (main i)) else
387339 Some (doclang_names (List.rev_map Cmd.name ancestors))
388340 | "iname" | "cmd" ->
389389- Some (doclang_names (List.rev_map Cmd.name (cmd ei :: ancestors ei)))
341341+ Some (doclang_names (List.rev_map Cmd.name (cmd i :: ancestors i)))
390342 | _ -> None
391343end
392344···417369(* Terms *)
418370419371module Term = struct
420420- type escape =
421421- [ `Error of bool * string
422422- | `Help of Cmdliner_manpage.format * string option ]
372372+ type escape = Arg.term_escape
373373+ type 'a parser = 'a Arg.term_parser
374374+ type 'a t = 'a Arg.term
375375+ let some (aset, parser) =
376376+ aset, (fun eval cline -> Result.map Option.some (parser eval cline))
377377+end
378378+379379+module Arg_completion = struct
380380+ type complete = Arg.complete
381381+ type 'a t = 'a Arg.completion
382382+383383+ let make
384384+ ?(complete = Fun.const []) ?(dirs = false) ?(files = false)
385385+ ?(restart = false) () : 'a t
386386+ =
387387+ {context = None; complete; dirs; files; restart}
388388+389389+ let none = make ()
390390+ let some (c : 'a t) =
391391+ { c with context = Option.map Term.some c.context }
423392424424- type 'a parser =
425425- Eval.t -> Cline.t -> ('a, [ `Parse of string | escape ]) result
393393+ let context (c : 'a t) = c.context
394394+ let complete (c : 'a t) = c.complete
395395+ let dirs (c : 'a t) = c.dirs
396396+ let files (c : 'a t) = c.files
397397+ let restart (c : 'a t) = c.restart
398398+end
426399427427- type 'a t = Arg.Set.t * 'a parser
400400+(* Converters *)
401401+402402+module Arg_conv = struct
403403+ type 'a parser = string -> ('a, string) result
404404+ type 'a fmt = Format.formatter -> 'a -> unit
405405+ type 'a t =
406406+ { docv : string;
407407+ parser : 'a parser;
408408+ pp : 'a fmt;
409409+ completion : 'a Arg_completion.t; }
410410+411411+ let make ?(completion = Arg_completion.none) ~docv ~parser ~pp () =
412412+ { docv; parser; pp; completion }
413413+414414+ let of_conv
415415+ conv ?(completion = conv.completion) ?(docv = conv.docv)
416416+ ?(parser = conv.parser) ?(pp = conv.pp) ()
417417+ =
418418+ { docv; parser; pp; completion }
419419+420420+ let docv c = c.docv
421421+ let parser c = c.parser
422422+ let pp c = c.pp
423423+ let completion c = c.completion
424424+425425+ let some ?(none = "") conv =
426426+ let parser s = match parser conv s with
427427+ | Ok v -> Ok (Some v) | Error _ as e -> e
428428+ in
429429+ let pp ppf v = match v with
430430+ | None -> Format.pp_print_string ppf none
431431+ | Some v -> pp conv ppf v
432432+ in
433433+ let completion = Arg_completion.some (completion conv) in
434434+ { conv with parser; pp; completion }
435435+436436+ let some' ?none conv =
437437+ let parser s = match parser conv s with
438438+ | Ok v -> Ok (Some v) | Error _ as e -> e
439439+ in
440440+ let pp ppf = function
441441+ | None -> (match none with None -> () | Some v -> (pp conv) ppf v)
442442+ | Some v -> pp conv ppf v
443443+ in
444444+ let completion = Arg_completion.some conv.completion in
445445+ { conv with parser; pp; completion }
428446end
+55-60
vendor/opam/cmdliner/src/cmdliner_info.mli
···33 SPDX-License-Identifier: ISC
44 ---------------------------------------------------------------------------*)
5566-(** Exit codes, environment variables, arguments, commands and eval information.
77-88- These information types gathers untyped data used to parse command
99- lines report errors and format man pages. *)
66+(** Core definitions. *)
107118(** Exit codes. *)
129module Exit : sig
···55525653(** Arguments *)
5754module Arg : sig
5858-5959- (* Completion strategies *)
6060-6161- module Completion : sig
6262- type complete = string -> (string * string) list
6363- type 'a t
6464- val make :
6565- ?complete:complete -> ?dirs:bool -> ?files:bool -> ?restart:bool ->
6666- unit -> 'a t
6767-6868- val none : 'a t
6969- val some : 'a t -> 'a option t
7070- val complete : 'a t -> complete
7171- val dirs : 'a t -> bool
7272- val files : 'a t -> bool
7373- val restart : 'a t -> bool
7474- end
7575-7676- (* Textual OCaml value converters *)
7777-7878- module Conv : sig
7979- type 'a parser = string -> ('a, string) result
8080- type 'a fmt = 'a Cmdliner_base.Fmt.t
8181- type 'a t
8282- val make :
8383- ?completion:'a Completion.t -> docv:string -> parser:'a parser ->
8484- pp:'a fmt -> unit -> 'a t
8585-8686- val of_conv : 'a t ->
8787- ?completion:'a Completion.t -> ?docv:string -> ?parser:'a parser ->
8888- ?pp:'a fmt -> unit -> 'a t
8989-9090- val docv : 'a t -> string
9191- val parser : 'a t -> 'a parser
9292- val pp : 'a t -> 'a fmt
9393- val completion : 'a t -> 'a Completion.t
9494-9595- val some : ?none:string -> 'a t -> 'a option t
9696- val some' : ?none:'a -> 'a t -> 'a option t
9797- end
9898-9955 type absence =
10056 | Err (** an error is reported. *)
10157 | Val of string Lazy.t (** if <> "", takes the given default value. *)
···161117 val styled_doc :
162118 errs:Format.formatter -> subst:Cmdliner_manpage.subst -> t -> string
163119120120+ type 'a completion
121121+ type e_completion = Completion : 'a completion -> e_completion
164122 module Map : Map.S with type key := t
165123 module Set : sig
166166- type arg = t
167167- type completion = V : 'a Completion.t -> completion
124124+ type arg := t
168125 type t
169126 val is_empty : t -> bool
170127 val empty : t
171171- val add : arg -> completion -> t -> t
172172- val choose : t -> arg * completion
173173- val partition : (arg -> completion -> bool) -> t -> t * t
174174- val filter : (arg -> completion -> bool) -> t -> t
175175- val iter : (arg -> completion -> unit) -> t -> unit
176176- val singleton : arg -> completion -> t
177177- val fold : (arg -> completion -> 'acc -> 'acc) -> t -> 'acc -> 'acc
128128+ val add : arg -> e_completion -> t -> t
129129+ val choose : t -> arg * e_completion
130130+ val partition : (arg -> e_completion -> bool) -> t -> t * t
131131+ val filter : (arg -> e_completion -> bool) -> t -> t
132132+ val iter : (arg -> e_completion -> unit) -> t -> unit
133133+ val singleton : arg -> e_completion -> t
134134+ val fold : (arg -> e_completion -> 'acc -> 'acc) -> t -> 'acc -> 'acc
178135 val elements : t -> arg list
179136 val union : t -> t -> t
180180- val find_opt : arg -> t -> completion option
181181- end with type arg := t
137137+ val find_opt : arg -> t -> e_completion option
138138+ end
182139end
183140184141(** Commands. *)
···212169 errs:Format.formatter -> subst:Cmdliner_manpage.subst -> t -> string
213170end
214171215215-216172(** Untyped command line parses. *)
217173module Cline : sig
218218- type arg = (* unconverted argument data as found on the command line. *)
174174+ type arg =
219175 | O of (int * string * (string option)) list (* (pos, name, value) of opt. *)
220220- | P of string list
176176+ | P of string list (** *)
177177+ (** Unconverted argument data as found on the command line. *)
221178222179 type t = arg Arg.Map.t (* command line, maps arg_infos to arg value. *)
223180end
···259216260217(** Terms, typed cli fragment definitions. *)
261218module Term : sig
262262-263219 type escape =
264220 [ `Error of bool * string
265221 | `Help of Cmdliner_manpage.format * string option ]
···269225270226 type 'a t = Arg.Set.t * 'a parser
271227end
228228+229229+(** Completion strategies *)
230230+module Arg_completion : sig
231231+ type complete = string -> (string * string) list
232232+ type 'a t = 'a Arg.completion
233233+ val make :
234234+ ?complete:complete -> ?dirs:bool -> ?files:bool -> ?restart:bool ->
235235+ unit -> 'a t
236236+237237+ val context : 'a t -> 'a Term.t option
238238+ val none : 'a t
239239+ val some : 'a t -> 'a option t
240240+ val complete : 'a t -> complete
241241+ val dirs : 'a t -> bool
242242+ val files : 'a t -> bool
243243+ val restart : 'a t -> bool
244244+end
245245+246246+(** Textual OCaml value converters *)
247247+module Arg_conv : sig
248248+ type 'a parser = string -> ('a, string) result
249249+ type 'a fmt = 'a Cmdliner_base.Fmt.t
250250+ type 'a t
251251+ val make :
252252+ ?completion:'a Arg_completion.t -> docv:string -> parser:'a parser ->
253253+ pp:'a fmt -> unit -> 'a t
254254+255255+ val of_conv : 'a t ->
256256+ ?completion:'a Arg_completion.t -> ?docv:string -> ?parser:'a parser ->
257257+ ?pp:'a fmt -> unit -> 'a t
258258+259259+ val docv : 'a t -> string
260260+ val parser : 'a t -> 'a parser
261261+ val pp : 'a t -> 'a fmt
262262+ val completion : 'a t -> 'a Arg_completion.t
263263+264264+ val some : ?none:string -> 'a t -> 'a option t
265265+ val some' : ?none:'a -> 'a t -> 'a option t
266266+end
+1-1
vendor/opam/cmdliner/src/cmdliner_term.mli
···1515(** Type type for command line parser. given static information about
1616 the command line and a command line to parse returns an OCaml value. *)
17171818-type +'a t
1818+type +'a t = 'a Cmdliner_info.Term.t
1919(** The type for terms. The list of arguments it can parse and the parsing
2020 function that does so. *)
2121