Add Arg_spec.of_result{,_map}
This commit is contained in:
parent
09ff33951b
commit
945583ff43
|
@ -71,3 +71,12 @@ let quote_args =
|
|||
| arg :: args -> quote :: arg :: loop quote args
|
||||
in
|
||||
fun quote args -> As (loop quote args)
|
||||
|
||||
let of_result = function
|
||||
| Ok x -> x
|
||||
| Error e -> Dyn (fun _ -> raise e)
|
||||
|
||||
let of_result_map res ~f =
|
||||
match res with
|
||||
| Ok x -> f x
|
||||
| Error e -> Dyn (fun _ -> raise e)
|
||||
|
|
|
@ -46,3 +46,6 @@ val expand : dir:Path.t -> 'a t list -> 'a -> string list * Path.Set.t
|
|||
|
||||
(** [quote_args quote args] is [As \[quote; arg1; quote; arg2; ...\]] *)
|
||||
val quote_args : string -> string list -> _ t
|
||||
|
||||
val of_result : ('a t, exn) result -> 'a t
|
||||
val of_result_map : ('a, exn) result -> f:('a -> 'b t) -> 'b t
|
||||
|
|
Loading…
Reference in New Issue