package ocamlbuild
Install
Dune Dependency
Authors
Maintainers
Sources
sha512=e918b9a0081f271e507c7a4f4d5d5a7cdf818ca51c52acec1bac85ddad5f6cad078cb3c568252fbcf5401c2d75323ed8f50fdd881bda1c9632840320408393ae
doc/ocamlbuild/Signatures/module-type-COMMAND/index.html
Module type Signatures.COMMAND
Provides an abstract type for easily building complex shell commands without making quotation mistakes.
The type t
provides some basic combinators and command primitives. Other commands can be made of command specifications (spec
).
and spec =
| N
(*No operation.
*)| S of spec list
(*A sequence. This gets flattened in the last stages
*)| A of string
(*An atom.
*)| P of pathname
(*A pathname.
*)| Px of pathname
(*A pathname, that will also be given to the call_with_target hook.
*)| Sh of string
(*A bit of raw shell code, that will not be escaped.
*)| T of tags
(*A set of tags, that describe properties and some semantics information about the command, afterward these tags will be replaced by command
*)spec
s (flags for instance).| V of string
(*A virtual command, that will be resolved at execution using
*)resolve_virtuals
| Quote of spec
(*Used for commands or part of commands, meant to be passed to
*)Sys.command
at some point.
The type for command specifications. That is pieces of command.
val atomize : string list -> spec
Will convert a string list to a list of atoms by adding A
constructors.
val atomize_paths : string list -> spec
Will convert a string list to a list of paths by adding P
constructors.
val run_spec_and_read : ?quiet:bool -> spec -> string
Run the command specification and returns its output
val execute : ?quiet:bool -> ?pretend:bool -> t -> unit
Run the command.
val execute_many :
?quiet:bool ->
?pretend:bool ->
t list ->
(bool list * exn) option
Run the commands in the given list, if possible in parallel. See the module Ocamlbuild_executor
.
val setup_virtual_command_solver : string -> (unit -> spec) -> unit
setup_virtual_command_solver virtual_command solver
the given solver can raise Not_found if it fails to find a valid command for this virtual command.
Search the given command in the command path and return its absolute pathname.
Simplify a command by flattening the sequences and resolving the tags into command-line options.
val print : Format.formatter -> t -> unit
Print a command (the format is not suitable to running the command).
val to_string : t -> string
Convert a command to a string (same format as print).
val string_of_command_spec : spec -> string
Build a string representation of a command that can be passed to the system calls.