Library
Module
Module type
Parameter
Class
Class type
Compilers of the EDSL.t
values.
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.
These functions are here for backwards compatibility, please use now the To_posix
module.
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 EDSL.fail
construct; one can avoid this setup with ~no_trap:true
If ~no_trap:true
is used and the script used the EDSL.fail
construct, to_one_liner
fails with an exception.
utop # Genspio.Compile.to_one_liner ~no_trap:true Genspio.EDSL.(seq [ eprintf (string "Hello\\n") []; fail ]);;
Exception: Failure
"Die command not set: you cannot use the `fail` construct together with the `~no_trap:true` option (error message was: \"EDSL.fail called\")".
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 an 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.