1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
open Ast

(*
--# Run Pipeline
--#
--# Re-executes a pipeline from start to finish.
--#
--# @name pipeline_run
--# @param p :: Pipeline The pipeline to run.
--# @return :: Pipeline The executed pipeline.
--# @family pipeline
--# @seealso pipeline_nodes
--# @export
*)
let register ~(rerun_pipeline : ?strict:bool -> ?verbose:bool -> value Env.t -> pipeline_result -> value) env =
  Env.add "pipeline_run"
    (make_builtin ~name:"pipeline_run" 1 (fun args env ->
      match args with
      | [VPipeline prev] -> rerun_pipeline ?strict:None env prev
      | [_] -> Error.type_error "Function `pipeline_run` expects a Pipeline."
      | _ -> Error.arity_error_named "pipeline_run" 1 (List.length args)
    ))
    env