Module Carcass.Bone

module Bone: sig .. end
Bones (single files).


Lookup


type id = Fpath.t 
The type for bone 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 OS.File.dash or an absolute path or starts with ./ and the path exists, Some id is returned.
val list : ?hidden:bool -> Carcass.Env.t -> Fpath.t Fpath.map
list ~hidden env maps bone identifiers found in the environment env to their path. If hidden is true hidden bones (those whose last segment start with a '_') are also in the map (defaults to false).

Bones


type content = 
| Binary of string (*
Binary bone.
*)
| Pat of Carcass.Pat.t (*
Textual bone.
*)
The type for bone contents. A bone is deemed binary if a null byte is found in its content.
type t 
The type for bones.
val id : t -> id
id b is the bone's id.
val content : t -> content
content b is the bone's content.
val is_exec : t -> bool
is_exec b is true if the bone is executable.
val of_input : ?trim:bool ->
src:Carcass.Loc.src ->
[ `String of string ] ->
is_exec:bool ->
id -> (t, [> Carcass.Error.parse ]) Result.result
of_input ~src input is_exec id reads a bone with id id from input. is_exec is the value for Carcass.Bone.is_exec. If trim is true (defaults to false), a textual bone's leading and trailing white space is trimmed with String.trim.
val of_path : ?trim:bool ->
Fpath.t ->
id ->
(t,
[> `Carcass_parse of Carcass.Error.parse_err * Carcass.Loc.t
| `Msg of string ])
Rresult.result
of_path ~trim p reads a bone with id id from path p using Carcass.Bone.of_input. The resulting bone's Carcass.Bone.is_exec is true iff the path is executable for the user.

Evaluation


val eval : Carcass.Pat.env ->
t -> (string, [> Carcass.Error.eval ]) Rresult.result
eval env b evaluates b to a string in the pattern evaluation environment env.