Module Carcass.Body

module Body: sig .. end
Bodies (file system hierarchies).


type id = Fpath.t 
The type for body ids.
val find : Carcass.Env.t -> id -> Fpath.t option
find env id finds the full path to the bone identified by id in environment env. If id is an absolute path or starts with ./ and the path exists, Some id is returned. If it is looked up in the environment and id has no .body extension one is added.
val list : ?hidden:bool -> Carcass.Env.t -> Fpath.t
list ~hidden env maps body ids found in the environment env to their path. If hidden is true hidden bodies (those whose last segment start with a '_') are also in the map (defaults to false).


type binding_id = Fpath.t 
The type for binding ids, either a bone id or a body id. Must be a relative path that doesn't start with ./.
type t 
The type for bodies
val id : t -> id
id b is the body's id. The id always has .body file extension.
val doc : t -> string * string
doc b is the synopsis and documentation of b.
val var_docs : t -> string
var_docs b maps a selection of variables to a documentation string.
val bindings : t ->
(Carcass.Pat.t * (binding_id * Carcass.Loc.t)) list
bindings b are the uninterpreted path bindings found in b.
val of_input : src:Carcass.Loc.src ->
[ `Channel of Pervasives.in_channel | `String of string ] ->
id -> (t, [> Carcass.Error.parse ]) Result.result
of_input ~src input id reads a body with id id from input.
val of_path : Fpath.t ->
id ->
[> `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t
| `Msg of string ])
of_path p id reads a body with id id from path p using Carcass.Body.of_input.


val eval_paths : Carcass.Env.t ->
Carcass.Pat.env ->
t ->
(( * Carcass.Loc.trace),
[> `Carcass_eval of Carcass.Error.eval_err * Carcass.Loc.trace
| `Msg of string ])
eval_paths env penv id b evaluates all the paths of bone b's bindings and maps them to their bone id using env to lookup sub-bodies and penv to evaluate the path patterns.
val eval_bones : Carcass.Env.t ->
Carcass.Pat.env ->
( * Carcass.Loc.trace) ->
((string * bool),
[> `Carcass_eval of Carcass.Error.eval_err * Carcass.Loc.trace
| `Msg of string ])
eval_bones env penv m evaluates all the bone ids in the path map m to their content and executable status using env to look them up and penv to evaluate textual bones.


val write : ?wrote:(Fpath.t -> unit) ->
?over:(Fpath.t -> bool) ->
dst:Fpath.t ->
(string * bool) -> (unit, [> Rresult.R.msg ]) Rresult.result
write ~log ~over ~dst m writes the paths defined in m (creating directories if needed) relative to dst according to the content they map to and setting the executable bit according to the boolean. If the complete path to write already exists it is called with over to determine if it should be overwritten, defaults to (fun _ -> Ok false). wrote is called with each complete path that was written (default to (fun _ -> ()))