package hg_lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=ee53cd5759f097c0d19da0ba413b3246acd485fe47bd70fd47694a309d5d9453
doc/hg_lib.open/Open_hg_lib/Hg/Make/argument-1-A/index.html
Parameter Make.A
module With_args : sig ... endA type that is intended to be used to add additional arguments to every function. E.g. the provided default uses this type to represent flags that can be passed to any hg command, like "--cwd".
module Output : sig ... endThe output type of an hg call, such as Deferred.t, Or_error.t, etc.
val run :
(args:string list ->
handle_output:(Async.Process.Output.t -> 'a Core.Or_error.t) ->
unit ->
'a Output.t)
With_args.trun should be a function that runs hg with the command line arguments args.
The handle_output function passed to run will be a function that can parse the output of the particular hg command being run -- for example, `hg push` exits with a different status depending on whether there are any changesets to push, so the handle_output function provided for the "push" commands will recognize which exit codes correspond to `Ok and which ones correspond to `Nothing_to_push.
Giving run this type, rather than a type that just returns a Process.Output.t, makes it more flexible and allows it to supply more complete information in error cases. For example, if run adds additional arguments (as happens in the top-level instantiation of this functor), run can add them to the error provided by handle_output.
It's not even necessary for run to call handle_output, if the type 'a Output.t doesn't reference 'a. An example of this is running hg in the foreground with Unix.fork_exec and Unix.waitpid, and using unit Deferred.t for the output type.