Module type Signatures.COMMAND
Provides an abstract type for easily building complex shell commands without making quotation mistakes.
type tagstype pathnametype t=|Seq of t listA sequence of commands (like the `;' in shell)
|Cmd of specA command is made of command specifications (
spec)|Echo of string list * pathnameWrite the given strings as is (newlines are not added) to the given file
|NopThe command that does nothing
The type
tprovides some basic combinators and command primitives. Other commands can be made of command specifications (spec).
and spec=|NNo operation.
|S of spec listA sequence. This gets flattened in the last stages
|A of stringAn atom.
|P of pathnameA pathname.
|Px of pathnameA pathname, that will also be given to the call_with_target hook.
|Sh of stringA bit of raw shell code, that will not be escaped.
|T of tagsA set of tags, that describe properties and some semantics information about the command, afterward these tags will be replaced by command
specs (flags for instance).|V of stringA virtual command, that will be resolved at execution using
resolve_virtuals|Quote of specA string that should be quoted like a filename but isn't really one.
The type for command specifications. That is pieces of command.
val atomize : string list -> specWill convert a string list to a list of atoms by adding
Aconstructors.
val atomize_paths : string list -> specWill convert a string list to a list of paths by adding
Pconstructors.
val execute : ?quiet:bool -> ?pretend:bool -> t -> unitRun the command.
val execute_many : ?quiet:bool -> ?pretend:bool -> t list -> (bool list * exn) optionRun the commands in the given list, if possible in parallel. See the module
Ocamlbuild_executor.
val setup_virtual_command_solver : string -> (unit -> spec) -> unitsetup_virtual_command_solver virtual_command solverthe given solver can raise Not_found if it fails to find a valid command for this virtual command.
val search_in_path : string -> stringSearch the given command in the command path and return its absolute pathname.
val reduce : spec -> specSimplify a command by flattening the sequences and resolving the tags into command-line options.
val print : Stdlib.Format.formatter -> t -> unitPrint a command (the format is not suitable to running the command).
val to_string : t -> stringConvert a command to a string (same format as print).
val string_of_command_spec : spec -> stringBuild a string representation of a command that can be passed to the system calls.