The unpac monorepo manager self-hosting as a monorepo using unpac
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Rename Cmdliner_info to Cmdliner_def

+308 -308
+2 -2
vendor/opam/cmdliner/src/cmdliner.ml
··· 6 6 module Manpage = Cmdliner_manpage 7 7 module Term = Cmdliner_term 8 8 module Cmd = struct 9 - module Exit = Cmdliner_info.Exit 10 - module Env = Cmdliner_info.Env 9 + module Exit = Cmdliner_def.Exit 10 + module Env = Cmdliner_def.Env 11 11 include Cmdliner_cmd 12 12 include Cmdliner_eval 13 13 end
+1 -1
vendor/opam/cmdliner/src/cmdliner.mllib
··· 1 1 Cmdliner_trie 2 2 Cmdliner_base 3 3 Cmdliner_manpage 4 - Cmdliner_info 4 + Cmdliner_def 5 5 Cmdliner_docgen 6 6 Cmdliner_msg 7 7 Cmdliner_cline
+52 -52
vendor/opam/cmdliner/src/cmdliner_arg.ml
··· 52 52 53 53 (* Argument converters *) 54 54 55 - module Completion = Cmdliner_info.Arg_completion 56 - module Conv = Cmdliner_info.Arg_conv 55 + module Completion = Cmdliner_def.Arg_completion 56 + module Conv = Cmdliner_def.Arg_conv 57 57 type 'a conv = 'a Conv.t 58 - let some = Cmdliner_info.Arg_conv.some 59 - let some' = Cmdliner_info.Arg_conv.some' 58 + let some = Cmdliner_def.Arg_conv.some 59 + let some' = Cmdliner_def.Arg_conv.some' 60 60 61 61 (* Argument information *) 62 62 63 63 type 'a t = 'a Cmdliner_term.t 64 - type info = Cmdliner_info.Arg_info.t 65 - let info = Cmdliner_info.Arg_info.make 64 + type info = Cmdliner_def.Arg_info.t 65 + let info = Cmdliner_def.Arg_info.make 66 66 67 67 (* Arguments *) 68 68 69 69 let no_completion = 70 - Cmdliner_info.Arg_info.Completion Cmdliner_info.Arg_completion.none 70 + Cmdliner_def.Arg_info.Completion Cmdliner_def.Arg_completion.none 71 71 72 72 let ( & ) f x = f x 73 73 let parse_error e = Error (`Parse e) ··· 82 82 let parse_to_list parser s = match parser s with 83 83 | Ok v -> Ok [v] | Error _ as e -> e 84 84 85 - let try_env ei a parse ~absent = match Cmdliner_info.Arg_info.env a with 85 + let try_env ei a parse ~absent = match Cmdliner_def.Arg_info.env a with 86 86 | None -> Ok absent 87 87 | Some env -> 88 - let var = Cmdliner_info.Env.info_var env in 89 - match Cmdliner_info.Eval.env_var ei var with 88 + let var = Cmdliner_def.Env.info_var env in 89 + match Cmdliner_def.Eval.env_var ei var with 90 90 | None -> Ok absent 91 91 | Some v -> 92 92 match parse v with 93 93 | Error e -> parse_error (Cmdliner_msg.err_env_parse env ~err:e) 94 94 | Ok _ as v -> v 95 95 96 - let arg_to_args a complete = Cmdliner_info.Arg_info.Set.singleton a complete 96 + let arg_to_args a complete = Cmdliner_def.Arg_info.Set.singleton a complete 97 97 let list_to_args f l complete = 98 - let add acc v = Cmdliner_info.Arg_info.Set.add (f v) complete acc in 99 - List.fold_left add Cmdliner_info.Arg_info.Set.empty l 98 + let add acc v = Cmdliner_def.Arg_info.Set.add (f v) complete acc in 99 + List.fold_left add Cmdliner_def.Arg_info.Set.empty l 100 100 101 101 let flag a = 102 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else 102 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else 103 103 let convert ei cl = match Cmdliner_cline.opt_arg cl a with 104 104 | [] -> try_env ei a env_bool_parse ~absent:false 105 105 | [_, _, None] -> Ok true ··· 110 110 Cmdliner_term.make (arg_to_args a no_completion) convert 111 111 112 112 let flag_all a = 113 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else 114 - let a = Cmdliner_info.Arg_info.make_all_opts a in 113 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else 114 + let a = Cmdliner_def.Arg_info.make_all_opts a in 115 115 let convert ei cl = match Cmdliner_cline.opt_arg cl a with 116 116 | [] -> try_env ei a (parse_to_list env_bool_parse) ~absent:[] 117 117 | l -> ··· 145 145 try Ok (aux None l) with Failure e -> parse_error e 146 146 in 147 147 let flag (_, a) = 148 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else a 148 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else a 149 149 in 150 150 Cmdliner_term.make (list_to_args flag l no_completion) convert 151 151 ··· 168 168 try Ok (aux [] l) with Failure e -> parse_error e 169 169 in 170 170 let flag (_, a) = 171 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else 172 - Cmdliner_info.Arg_info.make_all_opts a 171 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else 172 + Cmdliner_def.Arg_info.make_all_opts a 173 173 in 174 174 Cmdliner_term.make (list_to_args flag l no_completion) convert 175 175 ··· 177 177 | Ok v -> v | Error err -> failwith (Cmdliner_msg.err_opt_parse f ~err) 178 178 179 179 let opt ?vopt conv v a = 180 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else 181 - let absent = match Cmdliner_info.Arg_info.absent a with 182 - | Cmdliner_info.Arg_info.Doc d as a when d <> "" -> a 183 - | _ -> Cmdliner_info.Arg_info.Val (lazy (str_of_pp (Conv.pp conv) v)) 180 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else 181 + let absent = match Cmdliner_def.Arg_info.absent a with 182 + | Cmdliner_def.Arg_info.Doc d as a when d <> "" -> a 183 + | _ -> Cmdliner_def.Arg_info.Val (lazy (str_of_pp (Conv.pp conv) v)) 184 184 in 185 185 let kind = match vopt with 186 - | None -> Cmdliner_info.Arg_info.Opt 187 - | Some dv -> Cmdliner_info.Arg_info.Opt_vopt (str_of_pp (Conv.pp conv) dv) 186 + | None -> Cmdliner_def.Arg_info.Opt 187 + | Some dv -> Cmdliner_def.Arg_info.Opt_vopt (str_of_pp (Conv.pp conv) dv) 188 188 in 189 - let docv = match Cmdliner_info.Arg_info.docv a with 189 + let docv = match Cmdliner_def.Arg_info.docv a with 190 190 | "" -> Conv.docv conv | docv -> docv 191 191 in 192 - let a = Cmdliner_info.Arg_info.make_opt ~docv ~absent ~kind a in 192 + let a = Cmdliner_def.Arg_info.make_opt ~docv ~absent ~kind a in 193 193 let convert ei cl = match Cmdliner_cline.opt_arg cl a with 194 194 | [] -> try_env ei a (Conv.parser conv) ~absent:v 195 195 | [_, f, Some v] -> ··· 206 206 Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert 207 207 208 208 let opt_all ?vopt conv v a = 209 - if Cmdliner_info.Arg_info.is_pos a then invalid_arg err_not_opt else 210 - let absent = match Cmdliner_info.Arg_info.absent a with 211 - | Cmdliner_info.Arg_info.Doc d as a when d <> "" -> a 212 - | _ -> Cmdliner_info.Arg_info.Val (lazy "") 209 + if Cmdliner_def.Arg_info.is_pos a then invalid_arg err_not_opt else 210 + let absent = match Cmdliner_def.Arg_info.absent a with 211 + | Cmdliner_def.Arg_info.Doc d as a when d <> "" -> a 212 + | _ -> Cmdliner_def.Arg_info.Val (lazy "") 213 213 in 214 214 let kind = match vopt with 215 - | None -> Cmdliner_info.Arg_info.Opt 216 - | Some dv -> Cmdliner_info.Arg_info.Opt_vopt (str_of_pp (Conv.pp conv) dv) 215 + | None -> Cmdliner_def.Arg_info.Opt 216 + | Some dv -> Cmdliner_def.Arg_info.Opt_vopt (str_of_pp (Conv.pp conv) dv) 217 217 in 218 - let docv = match Cmdliner_info.Arg_info.docv a with 218 + let docv = match Cmdliner_def.Arg_info.docv a with 219 219 | "" -> Conv.docv conv | docv -> docv 220 220 in 221 - let a = Cmdliner_info.Arg_info.make_opt_all ~docv ~absent ~kind a in 221 + let a = Cmdliner_def.Arg_info.make_opt_all ~docv ~absent ~kind a in 222 222 let convert ei cl = match Cmdliner_cline.opt_arg cl a with 223 223 | [] -> try_env ei a (parse_to_list (Conv.parser conv)) ~absent:v 224 224 | l -> ··· 241 241 | Error err -> failwith (Cmdliner_msg.err_pos_parse a ~err) 242 242 243 243 let pos ?(rev = false) k conv v a = 244 - if Cmdliner_info.Arg_info.is_opt a then invalid_arg err_not_pos else 245 - let absent = match Cmdliner_info.Arg_info.absent a with 246 - | Cmdliner_info.Arg_info.Doc d as a when d <> "" -> a 247 - | _ -> Cmdliner_info.Arg_info.Val (lazy (str_of_pp (Conv.pp conv) v)) 244 + if Cmdliner_def.Arg_info.is_opt a then invalid_arg err_not_pos else 245 + let absent = match Cmdliner_def.Arg_info.absent a with 246 + | Cmdliner_def.Arg_info.Doc d as a when d <> "" -> a 247 + | _ -> Cmdliner_def.Arg_info.Val (lazy (str_of_pp (Conv.pp conv) v)) 248 248 in 249 - let pos = Cmdliner_info.Arg_info.pos ~rev ~start:k ~len:(Some 1) in 250 - let docv = match Cmdliner_info.Arg_info.docv a with 249 + let pos = Cmdliner_def.Arg_info.pos ~rev ~start:k ~len:(Some 1) in 250 + let docv = match Cmdliner_def.Arg_info.docv a with 251 251 | "" -> Conv.docv conv | docv -> docv 252 252 in 253 - let a = Cmdliner_info.Arg_info.make_pos_abs ~docv ~absent ~pos a in 253 + let a = Cmdliner_def.Arg_info.make_pos_abs ~docv ~absent ~pos a in 254 254 let convert ei cl = match Cmdliner_cline.pos_arg cl a with 255 255 | [] -> try_env ei a (Conv.parser conv) ~absent:v 256 256 | [v] -> ··· 261 261 Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert 262 262 263 263 let pos_list pos conv v a = 264 - if Cmdliner_info.Arg_info.is_opt a then invalid_arg err_not_pos else 265 - let docv = match Cmdliner_info.Arg_info.docv a with 264 + if Cmdliner_def.Arg_info.is_opt a then invalid_arg err_not_pos else 265 + let docv = match Cmdliner_def.Arg_info.docv a with 266 266 | "" -> Conv.docv conv | docv -> docv 267 267 in 268 - let a = Cmdliner_info.Arg_info.make_pos ~docv ~pos a in 268 + let a = Cmdliner_def.Arg_info.make_pos ~docv ~pos a in 269 269 let convert ei cl = match Cmdliner_cline.pos_arg cl a with 270 270 | [] -> try_env ei a (parse_to_list (Conv.parser conv)) ~absent:v 271 271 | l -> ··· 275 275 in 276 276 Cmdliner_term.make (arg_to_args a (Completion (Conv.completion conv))) convert 277 277 278 - let all = Cmdliner_info.Arg_info.pos ~rev:false ~start:0 ~len:None 278 + let all = Cmdliner_def.Arg_info.pos ~rev:false ~start:0 ~len:None 279 279 let pos_all c v a = pos_list all c v a 280 280 281 281 let pos_left ?(rev = false) k = 282 282 let start = if rev then k + 1 else 0 in 283 283 let len = if rev then None else Some k in 284 - pos_list (Cmdliner_info.Arg_info.pos ~rev ~start ~len) 284 + pos_list (Cmdliner_def.Arg_info.pos ~rev ~start ~len) 285 285 286 286 let pos_right ?(rev = false) k = 287 287 let start = if rev then 0 else k + 1 in 288 288 let len = if rev then Some k else None in 289 - pos_list (Cmdliner_info.Arg_info.pos ~rev ~start ~len) 289 + pos_list (Cmdliner_def.Arg_info.pos ~rev ~start ~len) 290 290 291 291 (* Arguments as terms *) 292 292 293 293 let absent_error args = 294 294 let make_req a v acc = 295 - let req_a = Cmdliner_info.Arg_info.make_req a in 296 - Cmdliner_info.Arg_info.Set.add req_a v acc 295 + let req_a = Cmdliner_def.Arg_info.make_req a in 296 + Cmdliner_def.Arg_info.Set.add req_a v acc 297 297 in 298 - Cmdliner_info.Arg_info.Set.fold make_req args Cmdliner_info.Arg_info.Set.empty 298 + Cmdliner_def.Arg_info.Set.fold make_req args Cmdliner_def.Arg_info.Set.empty 299 299 300 300 let value a = a 301 301 302 302 let err_arg_missing args = 303 303 parse_error @@ 304 - Cmdliner_msg.err_arg_missing (fst (Cmdliner_info.Arg_info.Set.choose args)) 304 + Cmdliner_msg.err_arg_missing (fst (Cmdliner_def.Arg_info.Set.choose args)) 305 305 306 306 let required t = 307 307 let args = absent_error (Cmdliner_term.argset t) in
+2 -2
vendor/opam/cmdliner/src/cmdliner_arg.mli
··· 53 53 type info 54 54 val info : 55 55 ?deprecated:string -> ?absent:string -> ?docs:string -> 56 - ?doc_envs:Cmdliner_info.Env.info list -> ?docv:string -> ?doc:string -> 57 - ?env:Cmdliner_info.Env.info -> string list -> info 56 + ?doc_envs:Cmdliner_def.Env.info list -> ?docv:string -> ?doc:string -> 57 + ?env:Cmdliner_def.Env.info -> string list -> info 58 58 59 59 val ( & ) : ('a -> 'b) -> 'a -> 'b 60 60
+37 -37
vendor/opam/cmdliner/src/cmdliner_cline.ml
··· 28 28 if not for_completion || not (has_complete_prefix s) then None else 29 29 Some (get_token_to_complete s) 30 30 31 - exception Completion_requested of Cmdliner_info.Complete.t 31 + exception Completion_requested of Cmdliner_def.Complete.t 32 32 33 33 let comp_request ?after_dashdash ~prefix kind = 34 - let comp = Cmdliner_info.Complete.make ?after_dashdash ~prefix kind in 34 + let comp = Cmdliner_def.Complete.make ?after_dashdash ~prefix kind in 35 35 raise (Completion_requested comp) 36 36 37 37 (* Command lines *) 38 38 39 39 let err_multi_opt_name_def name a a' = 40 40 let kind = "option name" in 41 - Cmdliner_base.err_multi_def ~kind name Cmdliner_info.Arg_info.doc a a' 41 + Cmdliner_base.err_multi_def ~kind name Cmdliner_def.Arg_info.doc a a' 42 42 43 - type arg = Cmdliner_info.Cline.arg 44 - type t = Cmdliner_info.Cline.t 43 + type arg = Cmdliner_def.Cline.arg 44 + type t = Cmdliner_def.Cline.t 45 45 46 46 let get_arg cline a : arg = 47 - try Cmdliner_info.Arg_info.Map.find a cline with Not_found -> assert false 47 + try Cmdliner_def.Arg_info.Map.find a cline with Not_found -> assert false 48 48 49 49 let opt_arg cline a = match get_arg cline a with O l -> l | _ -> assert false 50 50 let pos_arg cline a = match get_arg cline a with P l -> l | _ -> assert false ··· 63 63 let rec loop optidx posidx cline = function 64 64 | [] -> optidx, posidx, cline 65 65 | a :: l -> 66 - match Cmdliner_info.Arg_info.is_pos a with 66 + match Cmdliner_def.Arg_info.is_pos a with 67 67 | true -> 68 - let cline = Cmdliner_info.Arg_info.Map.add a (P [] : arg) cline in 68 + let cline = Cmdliner_def.Arg_info.Map.add a (P [] : arg) cline in 69 69 loop optidx (a :: posidx) cline l 70 70 | false -> 71 71 let add t name = match Cmdliner_trie.add t name a with 72 72 | `New t -> t 73 73 | `Replaced (a', _) -> invalid_arg (err_multi_opt_name_def name a a') 74 74 in 75 - let names = Cmdliner_info.Arg_info.opt_names a in 75 + let names = Cmdliner_def.Arg_info.opt_names a in 76 76 let optidx = List.fold_left add optidx names in 77 - let cline = Cmdliner_info.Arg_info.Map.add a (O [] : arg) cline in 77 + let cline = Cmdliner_def.Arg_info.Map.add a (O [] : arg) cline in 78 78 loop optidx posidx cline l 79 79 in 80 - let cline = Cmdliner_info.Arg_info.Map.empty in 81 - loop Cmdliner_trie.empty [] cline (Cmdliner_info.Arg_info.Set.elements args) 80 + let cline = Cmdliner_def.Arg_info.Map.empty in 81 + loop Cmdliner_trie.empty [] cline (Cmdliner_def.Arg_info.Set.elements args) 82 82 83 83 (* Optional argument parsing *) 84 84 ··· 126 126 127 127 let parse_opt_value ~for_completion arg_info name value args = 128 128 (* Either we got a value glued in [value] or we need to get one in args *) 129 - match Cmdliner_info.Arg_info.opt_kind arg_info with 129 + match Cmdliner_def.Arg_info.opt_kind arg_info with 130 130 | Flag -> (* Flags have no values but we may get dash sharing in [value] *) 131 131 begin match value with 132 132 | None -> value, args ··· 151 151 let try_complete_opt_value arg_info name value args = 152 152 (* At that point we found a matching option name so this should be mostly 153 153 about completing a glued option value, but there are twists. *) 154 - match Cmdliner_info.Arg_info.opt_kind arg_info with 155 - | Cmdliner_info.Arg_info.Flag -> 154 + match Cmdliner_def.Arg_info.opt_kind arg_info with 155 + | Cmdliner_def.Arg_info.Flag -> 156 156 begin match value with 157 157 | Some v when is_short_opt name -> 158 158 (* short flag dash sharing, push the completion *) ··· 205 205 else parse_opt_value ~for_completion arg_info name value args 206 206 in 207 207 let arg : arg = O ((k, name, value) :: opt_arg cline arg_info) in 208 - let cline = Cmdliner_info.Arg_info.Map.add arg_info arg cline in 208 + let cline = Cmdliner_def.Arg_info.Map.add arg_info arg cline in 209 209 loop errs (k + 1) cline pargs args 210 210 | Error `Not_found when for_completion -> 211 211 if not is_completion ··· 246 246 in the list index posidx, is given a value according the list 247 247 of positional arguments values [pargs]. *) 248 248 if pargs = [] then 249 - let misses = List.filter Cmdliner_info.Arg_info.is_req posidx in 249 + let misses = List.filter Cmdliner_def.Arg_info.is_req posidx in 250 250 if misses = [] then Ok cline else 251 251 Error (Cmdliner_msg.err_pos_misses misses, cline) 252 252 else ··· 255 255 let rec loop misses cline max_spec = function 256 256 | [] -> misses, cline, max_spec 257 257 | a :: al -> 258 - let apos = Cmdliner_info.Arg_info.pos_kind a in 259 - let rev = Cmdliner_info.Arg_info.pos_rev apos in 260 - let start = pos rev (Cmdliner_info.Arg_info.pos_start apos) in 261 - let stop = match Cmdliner_info.Arg_info.pos_len apos with 258 + let apos = Cmdliner_def.Arg_info.pos_kind a in 259 + let rev = Cmdliner_def.Arg_info.pos_rev apos in 260 + let start = pos rev (Cmdliner_def.Arg_info.pos_start apos) in 261 + let stop = match Cmdliner_def.Arg_info.pos_len apos with 262 262 | None -> pos rev last 263 - | Some n -> pos rev (Cmdliner_info.Arg_info.pos_start apos + n - 1) 263 + | Some n -> pos rev (Cmdliner_def.Arg_info.pos_start apos + n - 1) 264 264 in 265 265 let start, stop = if rev then stop, start else start, stop in 266 266 let args = 267 267 match take_range ~for_completion start stop pargs with 268 268 | `Range args -> args 269 269 | `Complete prefix -> 270 - let kind = Cmdliner_info.Complete.Opt_name_or_pos_value a in 270 + let kind = Cmdliner_def.Complete.Opt_name_or_pos_value a in 271 271 comp_request ~after_dashdash:has_dashdash ~prefix kind 272 272 in 273 273 let max_spec = max stop max_spec in 274 - let cline = Cmdliner_info.Arg_info.Map.add a (P args : arg) cline in 275 - let misses = match Cmdliner_info.Arg_info.is_req a && args = [] with 274 + let cline = Cmdliner_def.Arg_info.Map.add a (P args : arg) cline in 275 + let misses = match Cmdliner_def.Arg_info.is_req a && args = [] with 276 276 | true -> a :: misses 277 277 | false -> misses 278 278 in ··· 328 328 329 329 (* Deprecations *) 330 330 331 - type deprecated = Cmdliner_info.Arg_info.t * arg 331 + type deprecated = Cmdliner_def.Arg_info.t * arg 332 332 333 333 let deprecated ~env cline = 334 334 let add ~env info arg acc = 335 335 let deprecation_invoked = match (arg : arg) with 336 336 | O [] | P [] -> (* nothing on the cli for the argument *) 337 - begin match Cmdliner_info.Arg_info.env info with 337 + begin match Cmdliner_def.Arg_info.env info with 338 338 | None -> false 339 339 | Some ienv -> 340 340 (* the parse uses the env var if defined which may be deprecated *) 341 - Option.is_some (Cmdliner_info.Env.info_deprecated ienv) && 342 - Option.is_some (env (Cmdliner_info.Env.info_var ienv)) 341 + Option.is_some (Cmdliner_def.Env.info_deprecated ienv) && 342 + Option.is_some (env (Cmdliner_def.Env.info_var ienv)) 343 343 end 344 - | _ -> Option.is_some (Cmdliner_info.Arg_info.deprecated info) 344 + | _ -> Option.is_some (Cmdliner_def.Arg_info.deprecated info) 345 345 in 346 346 if deprecation_invoked then (info, arg) :: acc else acc 347 347 in 348 - List.rev (Cmdliner_info.Arg_info.Map.fold (add ~env) cline []) 348 + List.rev (Cmdliner_def.Arg_info.Map.fold (add ~env) cline []) 349 349 350 350 let pp_deprecated ~subst ppf (info, arg) = 351 351 let open Cmdliner_base in 352 352 let plural l = if List.length l > 1 then "s" else "" in 353 - let subst = Cmdliner_info.Arg_info.doclang_subst ~subst info in 353 + let subst = Cmdliner_def.Arg_info.doclang_subst ~subst info in 354 354 match (arg : arg) with 355 355 | O [] | P [] -> 356 - let env = Option.get (Cmdliner_info.Arg_info.env info) in 357 - let msg = Cmdliner_info.Env.styled_deprecated ~errs:ppf ~subst env in 356 + let env = Option.get (Cmdliner_def.Arg_info.env info) in 357 + let msg = Cmdliner_def.Env.styled_deprecated ~errs:ppf ~subst env in 358 358 Fmt.pf ppf "@[%a @[environment variable %a: %a@]@]" 359 - Fmt.deprecated () Fmt.code (Cmdliner_info.Env.info_var env) 359 + Fmt.deprecated () Fmt.code (Cmdliner_def.Env.info_var env) 360 360 Fmt.styled_text msg 361 361 | O os -> 362 362 let plural = plural os in 363 363 let names = List.map (fun (_, n, _) -> n) os in 364 - let msg = Cmdliner_info.Arg_info.styled_deprecated ~errs:ppf ~subst info in 364 + let msg = Cmdliner_def.Arg_info.styled_deprecated ~errs:ppf ~subst info in 365 365 Fmt.pf ppf "@[%a @[option%s %a: %a@]@]" 366 366 Fmt.deprecated () plural Fmt.(list ~sep:sp code_or_quote) names 367 367 Fmt.styled_text msg 368 368 | P args -> 369 369 let plural = plural args in 370 370 let msg = 371 - Cmdliner_info.Arg_info.styled_deprecated ~errs:ppf ~subst info 371 + Cmdliner_def.Arg_info.styled_deprecated ~errs:ppf ~subst info 372 372 in 373 373 Fmt.pf ppf "@[%a @[argument%s %a: %a@]@]" 374 374 Fmt.deprecated () plural Fmt.(list ~sep:sp code_or_quote) args
+6 -6
vendor/opam/cmdliner/src/cmdliner_cline.mli
··· 11 11 12 12 (** {1:cli Command lines} *) 13 13 14 - type t = Cmdliner_info.Cline.t 14 + type t = Cmdliner_def.Cline.t 15 15 16 16 val create : 17 17 ?peek_opts:bool -> legacy_prefixes:bool -> for_completion:bool -> 18 - Cmdliner_info.Arg_info.Set.t -> string list -> 18 + Cmdliner_def.Arg_info.Set.t -> string list -> 19 19 [ `Ok of t 20 - | `Complete of Cmdliner_info.Complete.t 20 + | `Complete of Cmdliner_def.Complete.t 21 21 | `Error of string * t ] 22 22 23 23 val opt_arg : 24 - t -> Cmdliner_info.Arg_info.t -> (int * string * (string option)) list 24 + t -> Cmdliner_def.Arg_info.t -> (int * string * (string option)) list 25 25 26 - val pos_arg : t -> Cmdliner_info.Arg_info.t -> string list 27 - val actual_args : t -> Cmdliner_info.Arg_info.t -> string list 26 + val pos_arg : t -> Cmdliner_def.Arg_info.t -> string list 27 + val actual_args : t -> Cmdliner_def.Arg_info.t -> string list 28 28 (** Actual command line arguments from the command line *) 29 29 30 30 (** {1:deprecations Deprecations} *)
+8 -8
vendor/opam/cmdliner/src/cmdliner_cmd.ml
··· 5 5 6 6 (* Commands *) 7 7 8 - type info = Cmdliner_info.Cmd_info.t 9 - let info = Cmdliner_info.Cmd_info.make 8 + type info = Cmdliner_def.Cmd_info.t 9 + let info = Cmdliner_def.Cmd_info.make 10 10 11 11 type 'a t = 12 12 | Cmd of info * 'a Cmdliner_term.parser 13 13 | Group of info * ('a Cmdliner_term.parser option * 'a t list) 14 14 15 15 let make info t = 16 - let info = Cmdliner_info.Cmd_info.add_args info (Cmdliner_term.argset t) in 16 + let info = Cmdliner_def.Cmd_info.add_args info (Cmdliner_term.argset t) in 17 17 Cmd (info, Cmdliner_term.parser t) 18 18 19 19 let v = make ··· 28 28 | Some t -> Some (Cmdliner_term.argset t), Some (Cmdliner_term.parser t) 29 29 in 30 30 let children = List.map get_info cmds in 31 - let info = Cmdliner_info.Cmd_info.with_children info ~args ~children in 31 + let info = Cmdliner_def.Cmd_info.with_children info ~args ~children in 32 32 Group (info, (parser, cmds)) 33 33 34 - let name c = Cmdliner_info.Cmd_info.name (get_info c) 34 + let name c = Cmdliner_def.Cmd_info.name (get_info c) 35 35 36 36 let name_trie cmds = 37 37 let add acc cmd = 38 38 let info = get_info cmd in 39 - let name = Cmdliner_info.Cmd_info.name info in 39 + let name = Cmdliner_def.Cmd_info.name info in 40 40 match Cmdliner_trie.add acc name cmd with 41 41 | `New t -> t 42 42 | `Replaced (cmd', _) -> 43 43 let info' = get_info cmd' and kind = "command" in 44 44 invalid_arg @@ 45 45 Cmdliner_base.err_multi_def ~kind name 46 - Cmdliner_info.Cmd_info.doc info info' 46 + Cmdliner_def.Cmd_info.doc info info' 47 47 in 48 48 List.fold_left add Cmdliner_trie.empty cmds 49 49 50 50 let list_names cmds = 51 - let cmd_name c = Cmdliner_info.Cmd_info.name (get_info c) in 51 + let cmd_name c = Cmdliner_def.Cmd_info.name (get_info c) in 52 52 List.sort String.compare (List.rev_map cmd_name cmds)
+3 -3
vendor/opam/cmdliner/src/cmdliner_cmd.mli
··· 5 5 6 6 (** Commands and their information. *) 7 7 8 - type info = Cmdliner_info.Cmd_info.t 8 + type info = Cmdliner_def.Cmd_info.t 9 9 10 10 val info : 11 11 ?deprecated:string -> ?man_xrefs:Cmdliner_manpage.xref list -> 12 - ?man:Cmdliner_manpage.block list -> ?envs:Cmdliner_info.Env.info list -> 13 - ?exits:Cmdliner_info.Exit.info list -> ?sdocs:string -> ?docs:string -> 12 + ?man:Cmdliner_manpage.block list -> ?envs:Cmdliner_def.Env.info list -> 13 + ?exits:Cmdliner_def.Exit.info list -> ?sdocs:string -> ?docs:string -> 14 14 ?doc:string -> ?version:string -> string -> info 15 15 16 16 type 'a t =
+19 -19
vendor/opam/cmdliner/src/cmdliner_completion.ml
··· 19 19 20 20 let pp_opt ~err_ppf ~subst ~prefix ppf arg_info _ = 21 21 (* XXX should we rather list a single name ? *) 22 - let names = Cmdliner_info.Arg_info.opt_names arg_info in 23 - let subst = Cmdliner_info.Arg_info.doclang_subst ~subst arg_info in 24 - let doc = Cmdliner_info.Arg_info.styled_doc ~errs:err_ppf ~subst arg_info in 22 + let names = Cmdliner_def.Arg_info.opt_names arg_info in 23 + let subst = Cmdliner_def.Arg_info.doclang_subst ~subst arg_info in 24 + let doc = Cmdliner_def.Arg_info.styled_doc ~errs:err_ppf ~subst arg_info in 25 25 List.iter (fun name -> pp_item ppf ~prefix (name, doc)) names 26 26 27 27 let pp_opt_names ~err_ppf ~subst ~prefix ppf cmd = 28 28 let info = Cmdliner_cmd.get_info cmd in 29 - let set = Cmdliner_info.Cmd_info.args info in 30 - if not (Cmdliner_info.Arg_info.Set.is_empty set) then begin 31 - let arg_infos = Cmdliner_info.Cmd_info.args info in 29 + let set = Cmdliner_def.Cmd_info.args info in 30 + if not (Cmdliner_def.Arg_info.Set.is_empty set) then begin 31 + let arg_infos = Cmdliner_def.Cmd_info.args info in 32 32 pp_group ppf "Options"; 33 - Cmdliner_info.Arg_info.Set.iter (pp_opt ~err_ppf ~subst ~prefix ppf) arg_infos 33 + Cmdliner_def.Arg_info.Set.iter (pp_opt ~err_ppf ~subst ~prefix ppf) arg_infos 34 34 end 35 35 36 36 let pp_arg_values ~after_dashdash ~prefix ppf comp = 37 - if after_dashdash && Cmdliner_info.Arg_completion.restart comp 37 + if after_dashdash && Cmdliner_def.Arg_completion.restart comp 38 38 then pp_line ppf "restart" else 39 - let items = Cmdliner_info.Arg_completion.complete comp prefix in 40 - let comp_files = Cmdliner_info.Arg_completion.files comp in 41 - let comp_dirs = Cmdliner_info.Arg_completion.dirs comp in 39 + let items = Cmdliner_def.Arg_completion.complete comp prefix in 40 + let comp_files = Cmdliner_def.Arg_completion.files comp in 41 + let comp_dirs = Cmdliner_def.Arg_completion.dirs comp in 42 42 if items <> [] || comp_files || comp_dirs then begin 43 43 pp_group ppf "Values"; 44 44 List.iter (pp_item ppf ~prefix) items; ··· 49 49 let pp_subcmds ~err_ppf ~subst ~prefix ppf cmd = 50 50 pp_group ppf "Subcommands"; 51 51 let complete_cmd cmd = 52 - let name = Cmdliner_info.Cmd_info.name cmd in 52 + let name = Cmdliner_def.Cmd_info.name cmd in 53 53 (* FIXME subst is wrong here. *) 54 - let doc = Cmdliner_info.Cmd_info.styled_doc ~errs:err_ppf ~subst cmd in 54 + let doc = Cmdliner_def.Cmd_info.styled_doc ~errs:err_ppf ~subst cmd in 55 55 pp_item ppf ~prefix (name, doc) 56 56 in 57 57 List.iter complete_cmd (Cmdliner_cmd.get_children_infos cmd) ··· 59 59 let vnum = 1 (* Protocol version number *) 60 60 61 61 let output ~out_ppf ~err_ppf ei cmd_args_info cmd comp = 62 - let subst = Cmdliner_info.Eval.doclang_subst ei in 63 - let after_dashdash = Cmdliner_info.Complete.after_dashdash comp in 64 - let prefix = Cmdliner_info.Complete.prefix comp in 62 + let subst = Cmdliner_def.Eval.doclang_subst ei in 63 + let after_dashdash = Cmdliner_def.Complete.after_dashdash comp in 64 + let prefix = Cmdliner_def.Complete.prefix comp in 65 65 let pp_arg_value ppf arg_info = 66 - begin match Cmdliner_info.Arg_info.Set.find_opt arg_info cmd_args_info with 66 + begin match Cmdliner_def.Arg_info.Set.find_opt arg_info cmd_args_info with 67 67 | None -> () 68 68 | Some (Completion comp) -> pp_arg_values ~after_dashdash ~prefix ppf comp 69 69 end; 70 70 in 71 71 let pp ppf () = 72 - begin match Cmdliner_info.Complete.kind comp with 72 + begin match Cmdliner_def.Complete.kind comp with 73 73 | Opt_value arg_info -> pp_arg_value ppf arg_info 74 74 | Opt_name_or_pos_value arg_info -> 75 75 pp_arg_value ppf arg_info; ··· 79 79 if not after_dashdash 80 80 then pp_opt_names ~err_ppf ~subst ~prefix ppf cmd; 81 81 end; 82 - if Cmdliner_info.Complete.subcmds comp 82 + if Cmdliner_def.Complete.subcmds comp 83 83 then pp_subcmds ~err_ppf ~subst ~prefix ppf cmd 84 84 in 85 85 Cmdliner_base.Fmt.pf out_ppf "@[<v>%d@,%a@]@?" vnum pp ()
+3 -3
vendor/opam/cmdliner/src/cmdliner_completion.mli
··· 6 6 val output : 7 7 out_ppf:Format.formatter -> 8 8 err_ppf:Format.formatter -> 9 - Cmdliner_info.Eval.t -> 10 - Cmdliner_info.Arg_info.Set.t -> 11 - 'a Cmdliner_cmd.t -> Cmdliner_info.Complete.t -> unit 9 + Cmdliner_def.Eval.t -> 10 + Cmdliner_def.Arg_info.Set.t -> 11 + 'a Cmdliner_cmd.t -> Cmdliner_def.Complete.t -> unit
+96 -96
vendor/opam/cmdliner/src/cmdliner_docgen.ml
··· 7 7 let strf = Printf.sprintf 8 8 9 9 let order_args a0 a1 = 10 - match Cmdliner_info.Arg_info.is_opt a0, Cmdliner_info.Arg_info.is_opt a1 with 10 + match Cmdliner_def.Arg_info.is_opt a0, Cmdliner_def.Arg_info.is_opt a1 with 11 11 | true, true -> (* optional by name *) 12 12 let key names = 13 13 let k = List.hd (List.sort rev_compare names) in ··· 15 15 if k.[1] = '-' then String.sub k 1 (String.length k - 1) else k 16 16 in 17 17 compare 18 - (key @@ Cmdliner_info.Arg_info.opt_names a0) 19 - (key @@ Cmdliner_info.Arg_info.opt_names a1) 18 + (key @@ Cmdliner_def.Arg_info.opt_names a0) 19 + (key @@ Cmdliner_def.Arg_info.opt_names a1) 20 20 | false, false -> (* positional by variable *) 21 21 compare 22 - (String.lowercase_ascii @@ Cmdliner_info.Arg_info.docv a0) 23 - (String.lowercase_ascii @@ Cmdliner_info.Arg_info.docv a1) 22 + (String.lowercase_ascii @@ Cmdliner_def.Arg_info.docv a0) 23 + (String.lowercase_ascii @@ Cmdliner_def.Arg_info.docv a1) 24 24 | true, false -> -1 (* positional first *) 25 25 | false, true -> 1 (* optional after *) 26 26 ··· 47 47 (* Command docs *) 48 48 49 49 let invocation ?(sep = " ") ?(ancestors = []) cmd = 50 - let names = List.rev_map Cmdliner_info.Cmd_info.name (cmd :: ancestors) in 50 + let names = List.rev_map Cmdliner_def.Cmd_info.name (cmd :: ancestors) in 51 51 esc @@ String.concat sep names 52 52 53 53 let synopsis_pos_arg a = 54 - let v = match Cmdliner_info.Arg_info.docv a with "" -> "ARG" | v -> v in 54 + let v = match Cmdliner_def.Arg_info.docv a with "" -> "ARG" | v -> v in 55 55 let v = strf "$(i,%s)" (esc v) in 56 56 let v = 57 - (if Cmdliner_info.Arg_info.is_req a then strf "%s" else strf "[%s]") v 57 + (if Cmdliner_def.Arg_info.is_req a then strf "%s" else strf "[%s]") v 58 58 in 59 - match Cmdliner_info.Arg_info.(pos_len @@ pos_kind a) with 59 + match Cmdliner_def.Arg_info.(pos_len @@ pos_kind a) with 60 60 | None -> v ^ "…" 61 61 | Some 1 -> v 62 62 | Some n -> ··· 64 64 String.concat " " (loop n []) 65 65 66 66 let synopsis_opt_arg a n = 67 - let var = match Cmdliner_info.Arg_info.docv a with "" -> "VAL" | v -> v in 68 - match Cmdliner_info.Arg_info.opt_kind a with 69 - | Cmdliner_info.Arg_info.Flag -> strf "$(b,%s)" (esc n) 70 - | Cmdliner_info.Arg_info.Opt -> 67 + let var = match Cmdliner_def.Arg_info.docv a with "" -> "VAL" | v -> v in 68 + match Cmdliner_def.Arg_info.opt_kind a with 69 + | Cmdliner_def.Arg_info.Flag -> strf "$(b,%s)" (esc n) 70 + | Cmdliner_def.Arg_info.Opt -> 71 71 if String.length n > 2 72 72 then strf "$(b,%s)=$(i,%s)" (esc n) (esc var) 73 73 else strf "$(b,%s) $(i,%s)" (esc n) (esc var) 74 - | Cmdliner_info.Arg_info.Opt_vopt _ -> 74 + | Cmdliner_def.Arg_info.Opt_vopt _ -> 75 75 if String.length n > 2 76 76 then strf "$(b,%s)[=$(i,%s)]" (esc n) (esc var) 77 77 else strf "$(b,%s) [$(i,%s)]" (esc n) (esc var) 78 78 79 - let deprecated cmd = match Cmdliner_info.Cmd_info.deprecated cmd with 79 + let deprecated cmd = match Cmdliner_def.Cmd_info.deprecated cmd with 80 80 | None -> "" | Some _ -> "(Deprecated) " 81 81 82 82 let synopsis ?(show_help = false) ?ancestors cmd = 83 83 let show_help = if show_help then " [$(b,--help)]" else "" in 84 - match Cmdliner_info.Cmd_info.children cmd with 84 + match Cmdliner_def.Cmd_info.children cmd with 85 85 | [] -> 86 86 let rev_cli_order (a0, _) (a1, _) = 87 - Cmdliner_info.Arg_info.rev_pos_cli_order a0 a1 87 + Cmdliner_def.Arg_info.rev_pos_cli_order a0 a1 88 88 in 89 - let args = Cmdliner_info.Cmd_info.args cmd in 89 + let args = Cmdliner_def.Cmd_info.args cmd in 90 90 let oargs, pargs = 91 - Cmdliner_info.Arg_info.(Set.partition (fun a _ -> is_opt a) args) 91 + Cmdliner_def.Arg_info.(Set.partition (fun a _ -> is_opt a) args) 92 92 in 93 93 let oargs = 94 94 (* Keep only those that are listed in the s_options section and 95 95 that are not [--version] or [--help]. * *) 96 96 let keep a _ = 97 97 let drop_names n = n = "--help" || n = "--version" in 98 - Cmdliner_info.Arg_info.docs a = Cmdliner_manpage.s_options && 99 - not (List.exists drop_names (Cmdliner_info.Arg_info.opt_names a)) 98 + Cmdliner_def.Arg_info.docs a = Cmdliner_manpage.s_options && 99 + not (List.exists drop_names (Cmdliner_def.Arg_info.opt_names a)) 100 100 in 101 - let oargs = Cmdliner_info.Arg_info.Set.(elements (filter keep oargs)) in 101 + let oargs = Cmdliner_def.Arg_info.Set.(elements (filter keep oargs)) in 102 102 let count = List.length oargs in 103 103 let any_option = "[$(i,OPTION)]…" in 104 104 if count = 0 || count > 3 then any_option else 105 105 let syn a = 106 106 let syn = 107 - synopsis_opt_arg a (Cmdliner_info.Arg_info.opt_name_sample a) 107 + synopsis_opt_arg a (Cmdliner_def.Arg_info.opt_name_sample a) 108 108 in 109 - if Cmdliner_info.Arg_info.is_req a 109 + if Cmdliner_def.Arg_info.is_req a 110 110 then syn 111 111 else strf "[%s]" syn 112 112 in ··· 115 115 String.concat " " [oargs; any_option] 116 116 in 117 117 let pargs = 118 - let pargs = Cmdliner_info.Arg_info.Set.elements pargs in 118 + let pargs = Cmdliner_def.Arg_info.Set.elements pargs in 119 119 if pargs = [] then "" else 120 120 let pargs = List.map (fun a -> a, synopsis_pos_arg a) pargs in 121 121 let pargs = List.sort rev_cli_order pargs in ··· 124 124 strf "%s$(b,%s)%s %s%s" 125 125 (deprecated cmd) (invocation ?ancestors cmd) show_help oargs pargs 126 126 | _cmds -> 127 - let subcmd = match Cmdliner_info.Cmd_info.has_args cmd with 127 + let subcmd = match Cmdliner_def.Cmd_info.has_args cmd with 128 128 | false -> "$(i,COMMAND)" | true -> "[$(i,COMMAND)]" 129 129 in 130 130 strf "%s$(b,%s)%s %s …" (deprecated cmd) (invocation ?ancestors cmd) 131 131 show_help subcmd 132 132 133 133 let cmd_doc cmd = 134 - let depr = match Cmdliner_info.Cmd_info.deprecated cmd with 134 + let depr = match Cmdliner_def.Cmd_info.deprecated cmd with 135 135 | None -> "" | Some msg -> msg ^ " " 136 136 in 137 - depr ^ Cmdliner_info.Cmd_info.doc cmd 137 + depr ^ Cmdliner_def.Cmd_info.doc cmd 138 138 139 - let cmd_docs ei = match Cmdliner_info.(Cmd_info.children (Eval.cmd ei)) with 139 + let cmd_docs ei = match Cmdliner_def.(Cmd_info.children (Eval.cmd ei)) with 140 140 | [] -> [] 141 141 | cmds -> 142 142 let add_cmd acc cmd = 143 143 let syn = synopsis cmd in 144 - (Cmdliner_info.Cmd_info.docs cmd, `I (syn, cmd_doc cmd)) :: acc 144 + (Cmdliner_def.Cmd_info.docs cmd, `I (syn, cmd_doc cmd)) :: acc 145 145 in 146 146 let by_sec_by_rev_name (s0, `I (c0, _)) (s1, `I (c1, _)) = 147 147 let c = compare s0 s1 in ··· 155 155 (* Argument docs *) 156 156 157 157 let arg_man_item_label a = 158 - let s = match Cmdliner_info.Arg_info.is_pos a with 159 - | true -> strf "$(i,%s)" (esc @@ Cmdliner_info.Arg_info.docv a) 158 + let s = match Cmdliner_def.Arg_info.is_pos a with 159 + | true -> strf "$(i,%s)" (esc @@ Cmdliner_def.Arg_info.docv a) 160 160 | false -> 161 - let names = List.sort compare (Cmdliner_info.Arg_info.opt_names a) in 161 + let names = List.sort compare (Cmdliner_def.Arg_info.opt_names a) in 162 162 String.concat ", " (List.rev_map (synopsis_opt_arg a) names) 163 163 in 164 - match Cmdliner_info.Arg_info.deprecated a with 164 + match Cmdliner_def.Arg_info.deprecated a with 165 165 | None -> s | Some _ -> "(Deprecated) " ^ s 166 166 167 167 let arg_to_man_item ~errs ~subst ~buf a = 168 - let subst = Cmdliner_info.Arg_info.doclang_subst ~subst a in 169 - let or_env ~value a = match Cmdliner_info.Arg_info.env a with 168 + let subst = Cmdliner_def.Arg_info.doclang_subst ~subst a in 169 + let or_env ~value a = match Cmdliner_def.Arg_info.env a with 170 170 | None -> "" 171 171 | Some e -> 172 172 let value = if value then " or" else "absent " in 173 - strf "%s $(b,%s) env" value (esc @@ Cmdliner_info.Env.info_var e) 173 + strf "%s $(b,%s) env" value (esc @@ Cmdliner_def.Env.info_var e) 174 174 in 175 - let absent = match Cmdliner_info.Arg_info.absent a with 176 - | Cmdliner_info.Arg_info.Err -> "required" 177 - | Cmdliner_info.Arg_info.Doc "" -> strf "%s" (or_env ~value:false a) 178 - | Cmdliner_info.Arg_info.Doc s -> 175 + let absent = match Cmdliner_def.Arg_info.absent a with 176 + | Cmdliner_def.Arg_info.Err -> "required" 177 + | Cmdliner_def.Arg_info.Doc "" -> strf "%s" (or_env ~value:false a) 178 + | Cmdliner_def.Arg_info.Doc s -> 179 179 let s = Cmdliner_manpage.subst_vars ~errs ~subst buf s in 180 180 strf "absent=%s%s" s (or_env ~value:true a) 181 - | Cmdliner_info.Arg_info.Val v -> 181 + | Cmdliner_def.Arg_info.Val v -> 182 182 match Lazy.force v with 183 183 | "" -> strf "%s" (or_env ~value:false a) 184 184 | v -> strf "absent=$(b,%s)%s" (esc v) (or_env ~value:true a) 185 185 in 186 - let optvopt = match Cmdliner_info.Arg_info.opt_kind a with 187 - | Cmdliner_info.Arg_info.Opt_vopt v -> strf "default=$(b,%s)" (esc v) 186 + let optvopt = match Cmdliner_def.Arg_info.opt_kind a with 187 + | Cmdliner_def.Arg_info.Opt_vopt v -> strf "default=$(b,%s)" (esc v) 188 188 | _ -> "" 189 189 in 190 190 let argvdoc = match optvopt, absent with ··· 192 192 | s, "" | "", s -> strf " (%s)" s 193 193 | s, s' -> strf " (%s) (%s)" s s' 194 194 in 195 - let deprecated = match Cmdliner_info.Arg_info.deprecated a with 195 + let deprecated = match Cmdliner_def.Arg_info.deprecated a with 196 196 | None -> "" | Some msg -> msg ^ " " 197 197 in 198 - let doc = deprecated ^ Cmdliner_info.Arg_info.doc a in 198 + let doc = deprecated ^ Cmdliner_def.Arg_info.doc a in 199 199 let doc = Cmdliner_manpage.subst_vars ~errs ~subst buf doc in 200 - (Cmdliner_info.Arg_info.docs a, `I (arg_man_item_label a ^ argvdoc, doc)) 200 + (Cmdliner_def.Arg_info.docs a, `I (arg_man_item_label a ^ argvdoc, doc)) 201 201 202 202 let arg_docs ~errs ~subst ~buf ei = 203 203 let by_sec_by_arg a0 a1 = 204 204 let c = compare 205 - (Cmdliner_info.Arg_info.docs a0) 206 - (Cmdliner_info.Arg_info.docs a1) 205 + (Cmdliner_def.Arg_info.docs a0) 206 + (Cmdliner_def.Arg_info.docs a1) 207 207 in 208 208 if c <> 0 then c else 209 209 let c = 210 210 match 211 - Cmdliner_info.Arg_info.deprecated a0, 212 - Cmdliner_info.Arg_info.deprecated a1 211 + Cmdliner_def.Arg_info.deprecated a0, 212 + Cmdliner_def.Arg_info.deprecated a1 213 213 with 214 214 | None, None | Some _, Some _ -> 0 215 215 | None, Some _ -> -1 | Some _, None -> 1 ··· 217 217 if c <> 0 then c else order_args a0 a1 218 218 in 219 219 let keep_arg a _ acc = 220 - if not Cmdliner_info.Arg_info.(is_pos a && (docv a = "" || doc a = "")) 220 + if not Cmdliner_def.Arg_info.(is_pos a && (docv a = "" || doc a = "")) 221 221 then (a :: acc) else acc 222 222 in 223 - let args = Cmdliner_info.Cmd_info.args @@ Cmdliner_info.Eval.cmd ei in 224 - let args = Cmdliner_info.Arg_info.Set.fold keep_arg args [] in 223 + let args = Cmdliner_def.Cmd_info.args @@ Cmdliner_def.Eval.cmd ei in 224 + let args = Cmdliner_def.Arg_info.Set.fold keep_arg args [] in 225 225 let args = List.sort by_sec_by_arg args in 226 226 let args = List.rev_map (arg_to_man_item ~errs ~subst ~buf) args in 227 227 sorted_items_to_blocks ~boilerplate:None args ··· 235 235 let exit_docs ~errs ~subst ~buf ~has_sexit ei = 236 236 let by_sec (s0, _) (s1, _) = compare s0 s1 in 237 237 let add_exit_item acc einfo = 238 - let subst = Cmdliner_info.Exit.doclang_subst ~subst einfo in 239 - let min, max = Cmdliner_info.Exit.info_codes einfo in 240 - let doc = Cmdliner_info.Exit.info_doc einfo in 238 + let subst = Cmdliner_def.Exit.doclang_subst ~subst einfo in 239 + let min, max = Cmdliner_def.Exit.info_codes einfo in 240 + let doc = Cmdliner_def.Exit.info_doc einfo in 241 241 let label = if min = max then strf "%d" min else strf "%d-%d" min max in 242 242 let item = `I (label, Cmdliner_manpage.subst_vars ~errs ~subst buf doc) in 243 - (Cmdliner_info.Exit.info_docs einfo, item) :: acc 243 + (Cmdliner_def.Exit.info_docs einfo, item) :: acc 244 244 in 245 - let exits = Cmdliner_info.Cmd_info.exits @@ Cmdliner_info.Eval.cmd ei in 246 - let exits = List.sort Cmdliner_info.Exit.info_order exits in 245 + let exits = Cmdliner_def.Cmd_info.exits @@ Cmdliner_def.Eval.cmd ei in 246 + let exits = List.sort Cmdliner_def.Exit.info_order exits in 247 247 let exits = List.fold_left add_exit_item [] exits in 248 248 let exits = List.stable_sort by_sec (* sort by section *) exits in 249 249 let boilerplate = if has_sexit then None else Some exit_boilerplate in ··· 257 257 258 258 let env_docs ~errs ~subst ~buf ~has_senv ei = 259 259 let add_env_item ~subst (seen, envs as acc) e = 260 - if Cmdliner_info.Env.Set.mem e seen then acc else 261 - let seen = Cmdliner_info.Env.Set.add e seen in 262 - let var = strf "$(b,%s)" @@ esc (Cmdliner_info.Env.info_var e) in 263 - let var, deprecated = match Cmdliner_info.Env.info_deprecated e with 260 + if Cmdliner_def.Env.Set.mem e seen then acc else 261 + let seen = Cmdliner_def.Env.Set.add e seen in 262 + let var = strf "$(b,%s)" @@ esc (Cmdliner_def.Env.info_var e) in 263 + let var, deprecated = match Cmdliner_def.Env.info_deprecated e with 264 264 | None -> var, "" | Some msg -> "(Deprecated) " ^ var, msg ^ " " in 265 - let doc = deprecated ^ Cmdliner_info.Env.info_doc e in 265 + let doc = deprecated ^ Cmdliner_def.Env.info_doc e in 266 266 let doc = Cmdliner_manpage.subst_vars ~errs ~subst buf doc in 267 - let envs = (Cmdliner_info.Env.info_docs e, `I (var, doc)) :: envs in 267 + let envs = (Cmdliner_def.Env.info_docs e, `I (var, doc)) :: envs in 268 268 seen, envs 269 269 in 270 270 let add_arg_envs a _ acc = 271 - let envs = Cmdliner_info.Arg_info.doc_envs a in 272 - let envs = match Cmdliner_info.Arg_info.env a with 271 + let envs = Cmdliner_def.Arg_info.doc_envs a in 272 + let envs = match Cmdliner_def.Arg_info.env a with 273 273 | None -> envs | Some e -> e :: envs 274 274 in 275 - let subst = Cmdliner_info.Arg_info.doclang_subst ~subst a in 275 + let subst = Cmdliner_def.Arg_info.doclang_subst ~subst a in 276 276 List.fold_left (add_env_item ~subst) acc envs 277 277 in 278 278 let add_env acc e = 279 - let subst = Cmdliner_info.Env.doclang_subst ~subst e in 279 + let subst = Cmdliner_def.Env.doclang_subst ~subst e in 280 280 add_env_item ~subst acc e 281 281 in 282 282 let by_sec_by_rev_name (s0, `I (v0, _)) (s1, `I (v1, _)) = ··· 285 285 in 286 286 (* Arg envs before term envs is important here: if the same is mentioned 287 287 both in an arg and in a term the substs of the arg are allowed. *) 288 - let args = Cmdliner_info.Cmd_info.args @@ Cmdliner_info.Eval.cmd ei in 289 - let tenvs = Cmdliner_info.Cmd_info.envs @@ Cmdliner_info.Eval.cmd ei in 290 - let init = Cmdliner_info.Env.Set.empty, [] in 291 - let acc = Cmdliner_info.Arg_info.Set.fold add_arg_envs args init in 288 + let args = Cmdliner_def.Cmd_info.args @@ Cmdliner_def.Eval.cmd ei in 289 + let tenvs = Cmdliner_def.Cmd_info.envs @@ Cmdliner_def.Eval.cmd ei in 290 + let init = Cmdliner_def.Env.Set.empty, [] in 291 + let acc = Cmdliner_def.Arg_info.Set.fold add_arg_envs args init in 292 292 let _, envs = List.fold_left add_env acc tenvs in 293 293 let envs = List.sort by_sec_by_rev_name envs in 294 294 let envs = (envs :> (string * Cmdliner_manpage.block) list) in ··· 298 298 (* xref doc *) 299 299 300 300 let xref_docs ~errs ei = 301 - let main = Cmdliner_info.Eval.main ei in 301 + let main = Cmdliner_def.Eval.main ei in 302 302 let to_xref = function 303 - | `Main -> Cmdliner_info.Cmd_info.name main, 1 303 + | `Main -> Cmdliner_def.Cmd_info.name main, 1 304 304 | `Tool tool -> tool, 1 305 305 | `Page (name, sec) -> name, sec 306 306 | `Cmd c -> 307 307 (* N.B. we are handling only the first subcommand level here *) 308 - let cmds = Cmdliner_info.Cmd_info.children main in 309 - let mname = Cmdliner_info.Cmd_info.name main in 310 - let is_cmd cmd = Cmdliner_info.Cmd_info.name cmd = c in 308 + let cmds = Cmdliner_def.Cmd_info.children main in 309 + let mname = Cmdliner_def.Cmd_info.name main in 310 + let is_cmd cmd = Cmdliner_def.Cmd_info.name cmd = c in 311 311 if List.exists is_cmd cmds then strf "%s-%s" mname c, 1 else 312 312 (Format.fprintf errs "xref %s: no such command name@." c; "doc-err", 0) 313 313 in 314 314 let xref_str (name, sec) = strf "%s(%d)" (esc name) sec in 315 - let xrefs = Cmdliner_info.Cmd_info.man_xrefs @@ Cmdliner_info.Eval.cmd ei in 316 - let xrefs = match main == Cmdliner_info.Eval.cmd ei with 315 + let xrefs = Cmdliner_def.Cmd_info.man_xrefs @@ Cmdliner_def.Eval.cmd ei in 316 + let xrefs = match main == Cmdliner_def.Eval.cmd ei with 317 317 | true -> List.filter (fun x -> x <> `Main) xrefs (* filter out default *) 318 318 | false -> xrefs 319 319 in ··· 326 326 327 327 let ensure_s_name ei sm = 328 328 if Cmdliner_manpage.(smap_has_section sm ~sec:s_name) then sm else 329 - let cmd = Cmdliner_info.Eval.cmd ei in 330 - let ancestors = Cmdliner_info.Eval.ancestors ei in 329 + let cmd = Cmdliner_def.Eval.cmd ei in 330 + let ancestors = Cmdliner_def.Eval.ancestors ei in 331 331 let tname = (deprecated cmd) ^ invocation ~sep:"-" ~ancestors cmd in 332 332 let tdoc = cmd_doc cmd in 333 333 let tagline = if tdoc = "" then "" else strf " - %s" tdoc in ··· 336 336 337 337 let ensure_s_synopsis ei sm = 338 338 if Cmdliner_manpage.(smap_has_section sm ~sec:s_synopsis) then sm else 339 - let cmd = Cmdliner_info.Eval.cmd ei in 340 - let ancestors = Cmdliner_info.Eval.ancestors ei in 339 + let cmd = Cmdliner_def.Eval.cmd ei in 340 + let ancestors = Cmdliner_def.Eval.ancestors ei in 341 341 let synopsis = `P (synopsis ~ancestors cmd) in 342 342 Cmdliner_manpage.(smap_append_block sm ~sec:s_synopsis synopsis) 343 343 344 344 let insert_cmd_man_docs ~errs ei sm = 345 345 let buf = Buffer.create 200 in 346 - let subst = Cmdliner_info.Eval.doclang_subst ei in 346 + let subst = Cmdliner_def.Eval.doclang_subst ei in 347 347 let ins sm (sec, b) = Cmdliner_manpage.smap_append_block sm ~sec b in 348 348 let has_senv = Cmdliner_manpage.(smap_has_section sm ~sec:s_environment) in 349 349 let has_sexit = Cmdliner_manpage.(smap_has_section sm ~sec:s_exit_status) in ··· 355 355 sm 356 356 357 357 let text ~errs ei = 358 - let man = Cmdliner_info.Cmd_info.man @@ Cmdliner_info.Eval.cmd ei in 358 + let man = Cmdliner_def.Cmd_info.man @@ Cmdliner_def.Eval.cmd ei in 359 359 let sm = Cmdliner_manpage.smap_of_blocks man in 360 360 let sm = ensure_s_name ei sm in 361 361 let sm = ensure_s_synopsis ei sm in ··· 363 363 Cmdliner_manpage.smap_to_blocks sm 364 364 365 365 let title ei = 366 - let main = Cmdliner_info.Eval.main ei in 367 - let exec = String.capitalize_ascii (Cmdliner_info.Cmd_info.name main) in 368 - let cmd = Cmdliner_info.Eval.cmd ei in 369 - let ancestors = Cmdliner_info.Eval.ancestors ei in 366 + let main = Cmdliner_def.Eval.main ei in 367 + let exec = String.capitalize_ascii (Cmdliner_def.Cmd_info.name main) in 368 + let cmd = Cmdliner_def.Eval.cmd ei in 369 + let ancestors = Cmdliner_def.Eval.ancestors ei in 370 370 let name = String.uppercase_ascii (invocation ~sep:"-" ~ancestors cmd) in 371 371 let center_header = esc @@ strf "%s Manual" exec in 372 372 let left_footer = 373 - let version = match Cmdliner_info.Cmd_info.version main with 373 + let version = match Cmdliner_def.Cmd_info.version main with 374 374 | None -> "" | Some v -> " " ^ v 375 375 in 376 376 esc @@ strf "%s%s" exec version ··· 380 380 let man ~errs ei = title ei, text ~errs ei 381 381 382 382 let pp_man ~env ~errs fmt ppf ei = 383 - let subst = Cmdliner_info.Eval.doclang_subst ei in 383 + let subst = Cmdliner_def.Eval.doclang_subst ei in 384 384 Cmdliner_manpage.print ~env ~errs ~subst fmt ppf (man ~errs ei) 385 385 386 386 (* Plain synopsis for usage *) 387 387 388 388 let styled_usage_synopsis ~errs ei = 389 - let subst = Cmdliner_info.Eval.doclang_subst ei in 390 - let cmd = Cmdliner_info.Eval.cmd ei in 391 - let ancestors = Cmdliner_info.Eval.ancestors ei in 389 + let subst = Cmdliner_def.Eval.doclang_subst ei in 390 + let cmd = Cmdliner_def.Eval.cmd ei in 391 + let ancestors = Cmdliner_def.Eval.ancestors ei in 392 392 let synopsis = synopsis ~show_help:true ~ancestors cmd in 393 393 Cmdliner_manpage.doc_to_styled ~errs ~subst synopsis
+2 -2
vendor/opam/cmdliner/src/cmdliner_docgen.mli
··· 6 6 val pp_man : 7 7 env:(string -> string option) -> 8 8 errs:Format.formatter -> Cmdliner_manpage.format -> Format.formatter -> 9 - Cmdliner_info.Eval.t -> unit 9 + Cmdliner_def.Eval.t -> unit 10 10 11 11 val styled_usage_synopsis : 12 - errs:Format.formatter -> Cmdliner_info.Eval.t -> string 12 + errs:Format.formatter -> Cmdliner_def.Eval.t -> string
+33 -33
vendor/opam/cmdliner/src/cmdliner_eval.ml
··· 5 5 6 6 type 'a eval_ok = [ `Ok of 'a | `Version | `Help ] 7 7 type eval_error = [ `Parse | `Term | `Exn ] 8 - type 'a eval_exit = [ `Ok of 'a | `Exit of Cmdliner_info.Exit.code ] 8 + type 'a eval_exit = [ `Ok of 'a | `Exit of Cmdliner_def.Exit.code ] 9 9 10 10 type 'a complete = 11 - Cmdliner_info.Arg_info.Set.t * 'a Cmdliner_cmd.t * Cmdliner_info.Complete.t 11 + Cmdliner_def.Arg_info.Set.t * 'a Cmdliner_cmd.t * Cmdliner_def.Complete.t 12 12 13 13 type eval_result_error = 14 14 [ Cmdliner_term.term_escape ··· 24 24 let err_argv = "argv array must have at least one element" 25 25 26 26 let add_stdopts ei = 27 - let docs = Cmdliner_info.Cmd_info.stdopts_docs (Cmdliner_info.Eval.cmd ei) in 27 + let docs = Cmdliner_def.Cmd_info.stdopts_docs (Cmdliner_def.Eval.cmd ei) in 28 28 let vargs, vers = 29 - match Cmdliner_info.Cmd_info.version (Cmdliner_info.Eval.main ei) with 30 - | None -> Cmdliner_info.Arg_info.Set.empty, None 29 + match Cmdliner_def.Cmd_info.version (Cmdliner_def.Eval.main ei) with 30 + | None -> Cmdliner_def.Arg_info.Set.empty, None 31 31 | Some _ -> 32 32 let vers = Cmdliner_arg.stdopt_version ~docs in 33 33 (Cmdliner_term.argset vers), Some vers 34 34 in 35 35 let help = Cmdliner_arg.stdopt_help ~docs in 36 36 let args = 37 - Cmdliner_info.Arg_info.Set.union vargs (Cmdliner_term.argset help) 37 + Cmdliner_def.Arg_info.Set.union vargs (Cmdliner_term.argset help) 38 38 in 39 - let cmd = Cmdliner_info.Cmd_info.add_args (Cmdliner_info.Eval.cmd ei) args in 40 - help, vers, Cmdliner_info.Eval.with_cmd ei cmd 39 + let cmd = Cmdliner_def.Cmd_info.add_args (Cmdliner_def.Eval.cmd ei) args in 40 + help, vers, Cmdliner_def.Eval.with_cmd ei cmd 41 41 42 42 let run_parser ~catch ei cl f = 43 43 try (f ei cl :> ('a, eval_result_error) result) with ··· 66 66 let ei = match cmd_name with 67 67 | None (* help of main command requested *) -> 68 68 let env _ = assert false in 69 - let cmd = Cmdliner_info.Eval.main ei in 70 - let ei' = Cmdliner_info.Eval.make ~cmd ~ancestors:[] ~env ~err_ppf in 71 - begin match Cmdliner_info.Eval.ancestors ei with 69 + let cmd = Cmdliner_def.Eval.main ei in 70 + let ei' = Cmdliner_def.Eval.make ~cmd ~ancestors:[] ~env ~err_ppf in 71 + begin match Cmdliner_def.Eval.ancestors ei with 72 72 | [] -> (* [ei] is an evaluation of main, [cmd] has stdopts *) ei' 73 73 | _ -> let _, _, ei = add_stdopts ei' in ei 74 74 end ··· 76 76 try 77 77 (* For now we simply keep backward compat. [cmd] should be 78 78 a name from main's children. *) 79 - let main = Cmdliner_info.Eval.main ei in 80 - let is_cmd t = Cmdliner_info.Cmd_info.name t = cmd in 81 - let children = Cmdliner_info.Cmd_info.children main in 79 + let main = Cmdliner_def.Eval.main ei in 80 + let is_cmd t = Cmdliner_def.Cmd_info.name t = cmd in 81 + let children = Cmdliner_def.Cmd_info.children main in 82 82 let cmd = List.find is_cmd children in 83 - let _, _, ei = add_stdopts (Cmdliner_info.Eval.with_cmd ei cmd) in 83 + let _, _, ei = add_stdopts (Cmdliner_def.Eval.with_cmd ei cmd) in 84 84 ei 85 85 with Not_found -> invalid_arg (err_help cmd) 86 86 in ··· 110 110 Error `Term 111 111 112 112 let do_deprecated_msgs ~env err_ppf cl ei = 113 - let cmd_info = Cmdliner_info.Eval.cmd ei in 113 + let cmd_info = Cmdliner_def.Eval.cmd ei in 114 114 let deprecated = Cmdliner_cline.deprecated ~env cl in 115 - match Cmdliner_info.Cmd_info.deprecated cmd_info, deprecated with 115 + match Cmdliner_def.Cmd_info.deprecated cmd_info, deprecated with 116 116 | None, [] -> () 117 117 | depr_cmd, deprs -> 118 118 let open Cmdliner_base in 119 119 let pp_sep ppf () = 120 120 if Option.is_some depr_cmd && deprs <> [] then Fmt.cut ppf (); 121 121 in 122 - let subst = Cmdliner_info.Eval.doclang_subst ei in 122 + let subst = Cmdliner_def.Eval.doclang_subst ei in 123 123 let pp_cmd_msg ppf cmd = 124 124 match 125 - Cmdliner_info.Cmd_info.styled_deprecated ~subst ~errs:err_ppf cmd 125 + Cmdliner_def.Cmd_info.styled_deprecated ~subst ~errs:err_ppf cmd 126 126 with 127 127 | "" -> () 128 128 | msg -> 129 - let name = Cmdliner_info.Cmd_info.name cmd in 129 + let name = Cmdliner_def.Cmd_info.name cmd in 130 130 Fmt.pf ppf "@[%a command %a:@[ %a@]@]" 131 131 Fmt.deprecated () Fmt.code_or_quote name Fmt.styled_text msg 132 132 in ··· 209 209 in 210 210 let help, version, ei = 211 211 let cmd_info = Cmdliner_cmd.get_info cmd in 212 - let ei = Cmdliner_info.Eval.make ~cmd:cmd_info ~ancestors ~env ~err_ppf in 212 + let ei = Cmdliner_def.Eval.make ~cmd:cmd_info ~ancestors ~env ~err_ppf in 213 213 add_stdopts ei 214 214 in 215 - let cmd_args_info = Cmdliner_info.Cmd_info.args (Cmdliner_info.Eval.cmd ei) in 215 + let cmd_args_info = Cmdliner_def.Cmd_info.args (Cmdliner_def.Eval.cmd ei) in 216 216 let cline = 217 217 Cmdliner_cline.create ~legacy_prefixes ~for_completion cmd_args_info args 218 218 in ··· 234 234 | Error `Complete -> 235 235 begin match cline with 236 236 | `Complete comp -> 237 - let comp = Cmdliner_info.Complete.add_subcmds comp in 237 + let comp = Cmdliner_def.Complete.add_subcmds comp in 238 238 Error (`Complete (cmd_args_info, cmd, comp)) 239 239 | `Ok _ | `Error _ -> assert false 240 240 end ··· 265 265 let version = if version_opt then Some "dummy" else None in 266 266 let cmd_info, parser = 267 267 let args, parser = Cmdliner_term.argset t, Cmdliner_term.parser t in 268 - let cmd_info = Cmdliner_info.Cmd_info.make ?version "dummy" in 269 - Cmdliner_info.Cmd_info.add_args cmd_info args, parser 268 + let cmd_info = Cmdliner_def.Cmd_info.make ?version "dummy" in 269 + Cmdliner_def.Cmd_info.add_args cmd_info args, parser 270 270 in 271 271 let help, version, ei = 272 272 let err_ppf = Format.make_formatter (fun _ _ _ -> ()) (fun () -> ()) in 273 273 let ancestors = [] in 274 - let ei = Cmdliner_info.Eval.make ~cmd:cmd_info ~ancestors ~env ~err_ppf in 274 + let ei = Cmdliner_def.Eval.make ~cmd:cmd_info ~ancestors ~env ~err_ppf in 275 275 add_stdopts ei 276 276 in 277 - let cmd_arg_infos = Cmdliner_info.Cmd_info.args (Cmdliner_info.Eval.cmd ei) in 277 + let cmd_arg_infos = Cmdliner_def.Cmd_info.args (Cmdliner_def.Eval.cmd ei) in 278 278 let cline = 279 279 Cmdliner_cline.create 280 280 ~peek_opts:true ~legacy_prefixes ~for_completion cmd_arg_infos args ··· 308 308 in 309 309 (v, ret) 310 310 311 - let exit_status_of_result ?(term_err = Cmdliner_info.Exit.cli_error) = function 312 - | Ok (`Ok _ | `Help | `Version) -> Cmdliner_info.Exit.ok 311 + let exit_status_of_result ?(term_err = Cmdliner_def.Exit.cli_error) = function 312 + | Ok (`Ok _ | `Help | `Version) -> Cmdliner_def.Exit.ok 313 313 | Error `Term -> term_err 314 - | Error `Parse -> Cmdliner_info.Exit.cli_error 315 - | Error `Exn -> Cmdliner_info.Exit.internal_error 314 + | Error `Parse -> Cmdliner_def.Exit.cli_error 315 + | Error `Exn -> Cmdliner_def.Exit.internal_error 316 316 317 317 let eval_value' ?help ?err ?catch ?env ?argv ?term_err cmd = 318 318 match eval_value ?help ?err ?catch ?env ?argv cmd with ··· 337 337 ?help ?(err = Format.err_formatter) ?catch ?env ?argv ?term_err cmd 338 338 = 339 339 match eval_value ?help ~err ?catch ?env ?argv cmd with 340 - | Ok (`Ok (Error msg)) -> pp_err err cmd ~msg; Cmdliner_info.Exit.some_error 340 + | Ok (`Ok (Error msg)) -> pp_err err cmd ~msg; Cmdliner_def.Exit.some_error 341 341 | r -> exit_status_of_result ?term_err r 342 342 343 343 let eval_result' ··· 345 345 = 346 346 match eval_value ?help ~err ?catch ?env ?argv cmd with 347 347 | Ok (`Ok (Ok c)) -> c 348 - | Ok (`Ok (Error msg)) -> pp_err err cmd ~msg; Cmdliner_info.Exit.some_error 348 + | Ok (`Ok (Error msg)) -> pp_err err cmd ~msg; Cmdliner_def.Exit.some_error 349 349 | r -> exit_status_of_result ?term_err r
+8 -8
vendor/opam/cmdliner/src/cmdliner_eval.mli
··· 7 7 8 8 type 'a eval_ok = [ `Ok of 'a | `Version | `Help ] 9 9 type eval_error = [ `Parse | `Term | `Exn ] 10 - type 'a eval_exit = [ `Ok of 'a | `Exit of Cmdliner_info.Exit.code ] 10 + type 'a eval_exit = [ `Ok of 'a | `Exit of Cmdliner_def.Exit.code ] 11 11 12 12 val eval_value : 13 13 ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> ··· 27 27 val eval : 28 28 ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> 29 29 ?env:(string -> string option) -> ?argv:string array -> 30 - ?term_err:int -> unit Cmdliner_cmd.t -> Cmdliner_info.Exit.code 30 + ?term_err:int -> unit Cmdliner_cmd.t -> Cmdliner_def.Exit.code 31 31 32 32 val eval' : 33 33 ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> 34 34 ?env:(string -> string option) -> ?argv:string array -> 35 - ?term_err:int -> int Cmdliner_cmd.t -> Cmdliner_info.Exit.code 35 + ?term_err:int -> int Cmdliner_cmd.t -> Cmdliner_def.Exit.code 36 36 37 37 val eval_result : 38 38 ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> 39 39 ?env:(string -> string option) -> ?argv:string array -> 40 - ?term_err:Cmdliner_info.Exit.code -> (unit, string) result Cmdliner_cmd.t -> 41 - Cmdliner_info.Exit.code 40 + ?term_err:Cmdliner_def.Exit.code -> (unit, string) result Cmdliner_cmd.t -> 41 + Cmdliner_def.Exit.code 42 42 43 43 val eval_result' : 44 44 ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> 45 45 ?env:(string -> string option) -> ?argv:string array -> 46 - ?term_err:Cmdliner_info.Exit.code -> 47 - (Cmdliner_info.Exit.code, string) result Cmdliner_cmd.t -> 48 - Cmdliner_info.Exit.code 46 + ?term_err:Cmdliner_def.Exit.code -> 47 + (Cmdliner_def.Exit.code, string) result Cmdliner_cmd.t -> 48 + Cmdliner_def.Exit.code
vendor/opam/cmdliner/src/cmdliner_info.ml vendor/opam/cmdliner/src/cmdliner_def.ml
vendor/opam/cmdliner/src/cmdliner_info.mli vendor/opam/cmdliner/src/cmdliner_def.mli
+10 -10
vendor/opam/cmdliner/src/cmdliner_msg.ml
··· 8 8 (* Environment variable errors *) 9 9 10 10 let err_env_parse env ~err = 11 - let var = Cmdliner_info.Env.info_var env in 11 + let var = Cmdliner_def.Env.info_var env in 12 12 Fmt.str "@[environment variable %a: %s@]" Fmt.code_or_quote var err 13 13 14 14 (* Positional argument errors *) ··· 18 18 Fmt.ereason "too many arguments" 19 19 Fmt.(list ~sep:comma code_or_quote) excess 20 20 21 - let err_pos_miss a = match Cmdliner_info.Arg_info.docv a with 21 + let err_pos_miss a = match Cmdliner_def.Arg_info.docv a with 22 22 | "" -> Fmt.str "@[a required argument is %a@]" Fmt.missing () 23 23 | v -> Fmt.str "@[required argument %a is %a@]" Fmt.code_var v Fmt.missing () 24 24 ··· 26 26 | [] -> assert false 27 27 | [a] -> err_pos_miss a 28 28 | args -> 29 - let add_arg acc a = match Cmdliner_info.Arg_info.docv a with 29 + let add_arg acc a = match Cmdliner_def.Arg_info.docv a with 30 30 | "" -> "ARG" :: acc 31 31 | argv -> argv :: acc 32 32 in 33 - let rev_args = List.sort Cmdliner_info.Arg_info.rev_pos_cli_order args in 33 + let rev_args = List.sort Cmdliner_def.Arg_info.rev_pos_cli_order args in 34 34 let args = List.fold_left add_arg [] rev_args in 35 35 Fmt.str "@[required arguments %a@ are@ %a@]" 36 36 Fmt.(list ~sep:comma code_var) args Fmt.missing () 37 37 38 - let err_pos_parse a ~err = match Cmdliner_info.Arg_info.docv a with 38 + let err_pos_parse a ~err = match Cmdliner_def.Arg_info.docv a with 39 39 | "" -> err 40 40 | argv -> 41 - match Cmdliner_info.Arg_info.(pos_len @@ pos_kind a) with 41 + match Cmdliner_def.Arg_info.(pos_len @@ pos_kind a) with 42 42 | Some 1 -> Fmt.str "@[%a argument: %s@]" Fmt.code_var argv err 43 43 | None | Some _ -> Fmt.str "@[%a… arguments: %s@]" Fmt.code_var argv err 44 44 ··· 67 67 (* Argument errors *) 68 68 69 69 let err_arg_missing a = 70 - if Cmdliner_info.Arg_info.is_pos a then err_pos_miss a else 70 + if Cmdliner_def.Arg_info.is_pos a then err_pos_miss a else 71 71 Fmt.str "@[required option %a is %a@]" 72 - Fmt.code (Cmdliner_info.Arg_info.opt_name_sample a) Fmt.missing () 72 + Fmt.code (Cmdliner_def.Arg_info.opt_name_sample a) Fmt.missing () 73 73 74 74 let err_cmd_missing ~dom = 75 75 Fmt.str "@[required %a name is %a,@ must@ be@ %a@]" ··· 78 78 (* Other messages *) 79 79 80 80 let pp_version ppf ei = 81 - match Cmdliner_info.Cmd_info.version (Cmdliner_info.Eval.main ei) with 81 + match Cmdliner_def.Cmd_info.version (Cmdliner_def.Eval.main ei) with 82 82 | None -> assert false 83 83 | Some v -> Fmt.pf ppf "@[%s@]@." v 84 84 85 - let exec_name ei = Cmdliner_info.Cmd_info.name (Cmdliner_info.Eval.main ei) 85 + let exec_name ei = Cmdliner_def.Cmd_info.name (Cmdliner_def.Eval.main ei) 86 86 87 87 let pp_exec_msg ppf ei = Fmt.pf ppf "%s:" (exec_name ei) 88 88
+9 -9
vendor/opam/cmdliner/src/cmdliner_msg.mli
··· 7 7 8 8 (** {1:env_err Environment variable errors} *) 9 9 10 - val err_env_parse : Cmdliner_info.Env.info -> err:string -> string 10 + val err_env_parse : Cmdliner_def.Env.info -> err:string -> string 11 11 12 12 (** {1:pos_err Positional argument errors} *) 13 13 14 14 val err_pos_excess : string list -> string 15 - val err_pos_misses : Cmdliner_info.Arg_info.t list -> string 16 - val err_pos_parse : Cmdliner_info.Arg_info.t -> err:string -> string 15 + val err_pos_misses : Cmdliner_def.Arg_info.t list -> string 16 + val err_pos_parse : Cmdliner_def.Arg_info.t -> err:string -> string 17 17 18 18 (** {1:opt_err Optional argument errors} *) 19 19 ··· 24 24 25 25 (** {1:arg_err Argument errors} *) 26 26 27 - val err_arg_missing : Cmdliner_info.Arg_info.t -> string 27 + val err_arg_missing : Cmdliner_def.Arg_info.t -> string 28 28 val err_cmd_missing : dom:string list -> string 29 29 30 30 (** {1:msgs Other messages} *) 31 31 32 - val pp_version : Cmdliner_info.Eval.t Cmdliner_base.Fmt.t 32 + val pp_version : Cmdliner_def.Eval.t Cmdliner_base.Fmt.t 33 33 34 34 35 - val pp_exec_msg : Cmdliner_info.Eval.t Cmdliner_base.Fmt.t 35 + val pp_exec_msg : Cmdliner_def.Eval.t Cmdliner_base.Fmt.t 36 36 37 37 val pp_err : 38 - Format.formatter -> Cmdliner_info.Eval.t -> err:string -> unit 38 + Format.formatter -> Cmdliner_def.Eval.t -> err:string -> unit 39 39 40 40 val pp_usage_and_err : 41 - Format.formatter -> Cmdliner_info.Eval.t -> err:string -> unit 41 + Format.formatter -> Cmdliner_def.Eval.t -> err:string -> unit 42 42 43 43 val pp_backtrace : 44 - Format.formatter -> Cmdliner_info.Eval.t -> exn -> Printexc.raw_backtrace -> 44 + Format.formatter -> Cmdliner_def.Eval.t -> exn -> Printexc.raw_backtrace -> 45 45 unit
+13 -13
vendor/opam/cmdliner/src/cmdliner_term.ml
··· 3 3 SPDX-License-Identifier: ISC 4 4 ---------------------------------------------------------------------------*) 5 5 6 - type term_escape = Cmdliner_info.Term.escape 7 - type 'a parser = 'a Cmdliner_info.Term.parser 8 - type +'a t = 'a Cmdliner_info.Term.t 6 + type term_escape = Cmdliner_def.Term.escape 7 + type 'a parser = 'a Cmdliner_def.Term.parser 8 + type +'a t = 'a Cmdliner_def.Term.t 9 9 10 10 let make args p = (args, p) 11 11 let argset (args, _) = args 12 12 let parser (_, parser) = parser 13 13 14 - let const v = Cmdliner_info.Arg_info.Set.empty, (fun _ _ -> Ok v) 14 + let const v = Cmdliner_def.Arg_info.Set.empty, (fun _ _ -> Ok v) 15 15 let app (args_f, f) (args_v, v) = 16 - Cmdliner_info.Arg_info.Set.union args_f args_v, 16 + Cmdliner_def.Arg_info.Set.union args_f args_v, 17 17 fun ei cl -> match (f ei cl) with 18 18 | Error _ as e -> e 19 19 | Ok f -> ··· 63 63 cli_parse_result wrap 64 64 65 65 let main_name = 66 - Cmdliner_info.Arg_info.Set.empty, 67 - (fun ei _ -> Ok (Cmdliner_info.Cmd_info.name @@ Cmdliner_info.Eval.main ei)) 66 + Cmdliner_def.Arg_info.Set.empty, 67 + (fun ei _ -> Ok (Cmdliner_def.Cmd_info.name @@ Cmdliner_def.Eval.main ei)) 68 68 69 69 let choice_names = 70 - Cmdliner_info.Arg_info.Set.empty, 70 + Cmdliner_def.Arg_info.Set.empty, 71 71 (fun ei _ -> 72 72 (* N.B. this keeps everything backward compatible. We return the command 73 73 names of main's children *) 74 - let name t = Cmdliner_info.Cmd_info.name t in 74 + let name t = Cmdliner_def.Cmd_info.name t in 75 75 let choices = 76 - Cmdliner_info.Cmd_info.children (Cmdliner_info.Eval.main ei) 76 + Cmdliner_def.Cmd_info.children (Cmdliner_def.Eval.main ei) 77 77 in 78 78 Ok (List.rev_map name choices)) 79 79 ··· 86 86 List.rev_append args acc 87 87 in 88 88 let used = 89 - List.rev (Cmdliner_info.Arg_info.Set.fold actual_args al []) 89 + List.rev (Cmdliner_def.Arg_info.Set.fold actual_args al []) 90 90 in 91 91 Ok (x, used) 92 92 | Error _ as e -> e 93 93 94 94 95 95 let env = 96 - Cmdliner_info.Arg_info.Set.empty, 97 - (fun ei _ -> Ok (Cmdliner_info.Eval.env_var ei)) 96 + Cmdliner_def.Arg_info.Set.empty, 97 + (fun ei _ -> Ok (Cmdliner_def.Eval.env_var ei))
+4 -4
vendor/opam/cmdliner/src/cmdliner_term.mli
··· 10 10 | `Help of Cmdliner_manpage.format * string option ] 11 11 12 12 type 'a parser = 13 - Cmdliner_info.Eval.t -> Cmdliner_cline.t -> 13 + Cmdliner_def.Eval.t -> Cmdliner_cline.t -> 14 14 ('a, [ `Parse of string | term_escape ]) result 15 15 (** Type type for command line parser. given static information about 16 16 the command line and a command line to parse returns an OCaml value. *) 17 17 18 - type +'a t = 'a Cmdliner_info.Term.t 18 + type +'a t = 'a Cmdliner_def.Term.t 19 19 (** The type for terms. The list of arguments it can parse and the parsing 20 20 function that does so. *) 21 21 22 - val make : Cmdliner_info.Arg_info.Set.t -> 'a parser -> 'a t 23 - val argset : 'a t -> Cmdliner_info.Arg_info.Set.t 22 + val make : Cmdliner_def.Arg_info.Set.t -> 'a parser -> 'a t 23 + val argset : 'a t -> Cmdliner_def.Arg_info.Set.t 24 24 val parser : 'a t -> 'a parser 25 25 26 26 val const : 'a -> 'a t