package mirage
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=0c07d59eb52dc3d1506eb4121c4953104a12df79d08a0f0923c9b71e7474a026
sha512=666bf9ee20c9f9de058441f252f4f40ceec6a9ffd00e5cd3b7bfa9532fd65000aeb8a83f9e55586be98d0a86ea72f2dda94e924608135e3d63441359505de58a
doc/mirage.functoria/Functoria/Action/index.html
Module Functoria.Action
Source
Wrapper around Bos
which provides a "dry run" feature.
The action type
An action that when executed may return a value of type 'a
.
errorf fmt
is the failed action with error message fmt
.
Actions
with_dir d f
runs f
with d
as current working directory. (See Bos.OS.Dir.with_current
).
size_of f
is Some i
if f
exists and is of size i
, and None
if f
doesn't exist.
set_var v c
sets env variable c
to c
. (see Bos.OS.Env.set_var
)
get_var v
gets the value of the variable c
in the environment. (see Bos.OS.Env.get
)
The type for channels.
Run a command. By default, err
is Fmt.stderr
and out
is Fmt.stdout
. (see Bos.OS.Cmd.run
)
Run a command and return its trimmed stdout. By default err
is Fmt.stderr
. (See Bos.OS.Cmd.run_out
)
Run a command as a command line interface, meaning stdout and stderr remain untouched.
Write some data to a file. (see Bos.OS.File.write
)
tmp_file pat
is a tempory file built using the pattern pat
. (See Bos.OS.File.tmp
)
val with_output :
?mode:int ->
?append:bool ->
path:Fpath.t ->
purpose:string ->
(Format.formatter -> 'a) ->
'a t
Open a file with a given mode, and write some data to it through a function. (see Bos.OS.File.with_oc
). purpose
is used in error messages. If append
is set (by default it is not), the data is appended to path
.
Interpreters
Run the command through Bos
.
The type for virtual environments.
default_exec cmd
is Some ("$(<cmd>)", "")
.
The type for interpreted values.
eq_domain
is the equality function between domain
s.
Emulate the action. This will not do IO on the actual files. Some approximation is done to determine the result of actions. files
is a list of paths that are supposed to exist at the beginning. Returns:
- the result of the action (which can be an
Bos
error) - the list of files after execution
- a trace (list of log messages)
generated_files t
is the set of files created by t
. Note: this might be incomplete/incorrect in case of calls to external commands.