Compilers of the EDSL.t values.

Pretty-printing Output

val pp_hum : Format.formatter -> 'a EDSL.t -> unit

Pretty print a Genspio expression with the Format module.

val to_string_hum : 'a EDSL.t -> string

Pretty print a Genspio expression to string.

val to_one_line_hum : 'a EDSL.t -> string

Like to_string_hum but avoiding new-lines.

Compilation to POSIX Shell Scripts

module To_posix : sig ... end

Compiler from EDSL.t to POSIX shell scripts (one-liners or multiline scripts).

module To_slow_flow : sig ... end

Compile EDSL.t values to much slower but more portable scripts (which use temporary-files).

Legacy API

These functions are here for backwards compatibility, please use now the To_posix module.

val default_max_argument_length : int option

See argument ?max_argument_length of to_one_liner.

val to_one_liner : ?max_argument_length:int option -> ?no_trap:bool -> 'a EDSL.t -> string

Compile a Genspio expression to a single-line POSIX shell command.

The shell command starts by using "trap" to allow the script to abort thorugh the construct; one can avoid this setup with ~no_trap:true

If ~no_trap:true is used and the script used the construct, to_one_liner fails with an exception.

utop # Genspio.Compile.to_one_liner
           seq [
             eprintf (str "Hello\\n") [];
             fail "Foo"
 "Error: Call to `fail (user Foo)` while no “die” command is configured.;
  Code: NONE; Comment-backtrace: [] ".

The default value for max_argument_length is default_max_argument_length (Some 100_000); it is a limit on the length of the literal command line arguments generated by the compiler. None means “do not check.”

If the compilation fails, the function raises a Failure exception containing the error message.

val to_many_lines : ?max_argument_length:int option -> ?no_trap:bool -> 'a EDSL.t -> string

Compile a Genspio expression to a multi-line POSIX shell script, slightly more readable than to_one_liner.

val quick_run_exn : ?max_argument_length:int option -> ?no_trap:bool -> 'a EDSL.t -> unit

Compile an expression and use Sys.command on it; if the overall command does not return 0 an exception is raised.