module Augeas:sig..end
Augeas OCaml bindings
type t
Augeas library handle.
type flag =
| |
AugSaveBackup |
(* | Rename original with .augsave | *) |
| |
AugSaveNewFile |
(* | Save changes to .augnew | *) |
| |
AugTypeCheck |
(* | Type-check lenses | *) |
| |
AugNoStdinc |
|||
| |
AugSaveNoop |
|||
| |
AugNoLoad |
|||
| |
AugNoModlAutoload |
|||
| |
AugEnableSpan |
|||
| |
AugNoErrClose |
|||
| |
AugTraceModuleLoading |
(* | Flags passed to the | *) |
type error_code =
| |
AugErrInternal |
(* | Internal error (bug) | *) |
| |
AugErrPathX |
(* | Invalid path expression | *) |
| |
AugErrNoMatch |
(* | No match for path expression | *) |
| |
AugErrMMatch |
(* | Too many matches for path expression | *) |
| |
AugErrSyntax |
(* | Syntax error in lens file | *) |
| |
AugErrNoLens |
(* | Lens lookup failed | *) |
| |
AugErrMXfm |
(* | Multiple transforms | *) |
| |
AugErrNoSpan |
(* | No span for this node | *) |
| |
AugErrMvDesc |
(* | Cannot move node into its descendant | *) |
| |
AugErrCmdRun |
(* | Failed to execute command | *) |
| |
AugErrBadArg |
(* | Invalid argument in funcion call | *) |
| |
AugErrLabel |
(* | Invalid label | *) |
| |
AugErrCpDesc |
(* | Cannot copy node into its descendant | *) |
| |
AugErrUnknown of |
(* | Possible error codes. | *) |
type transform_mode =
| |
Include |
|||
| |
Exclude |
(* | The operation mode for the | *) |
exception Error of error_code * string * string * string * string
This exception is thrown when the underlying Augeas library returns an error. The tuple represents:
typepath =string
A path expression.
Note in future we may replace this with a type-safe path constructor.
typevalue =string
A value.
val create : string -> string option -> flag list -> tcreate root loadpath flags creates an Augeas handle.
root is a file system path describing the location
of the configuration files.
loadpath is an optional colon-separated list of directories
which are searched for schema definitions.
flags is a list of flags.
val close : t -> unitclose handle closes the handle.
You don't need to close handles explicitly with this function: they will be finalized eventually by the garbage collector. However calling this function frees up any resources used by the underlying Augeas library immediately.
Do not use the handle after closing it.
val defnode : t -> string -> string -> string option -> int * booldefnode t name expr value defines name whose value is the
result of evaluating expr, which is a nodeset.
val defvar : t -> string -> string option -> int optiondefvar t name expr defines name whose value is the result
of evaluating expr, replacing the old value if existing.
None as expr removes the variable name.
val get : t -> path -> value optionget t path returns the value at path, or None if there
is no value.
val exists : t -> path -> boolexists t path returns true iff there is a value at path.
val insert : t -> ?before:bool -> path -> string -> unitinsert t ?before path label inserts label as a sibling
of path. By default it is inserted after path, unless
~before:true is specified.
val label : t -> path -> string optionlabel t path gets the label of path.
Returns Some value when path matches only one node, and
that has an associated label.
val rm : t -> path -> intrm t path removes all nodes matching path.
Returns the number of nodes removed (which may be 0).
val matches : t -> path -> path listmatches t path returns a list of path expressions
of all nodes matching path.
val mv : t -> path -> path -> unitmv t src dest moves a node.
val count_matches : t -> path -> intcount_matches t path counts the number of nodes matching
path but does not return them (see Augeas.matches).
val save : t -> unitsave t saves all pending changes to disk.
val load : t -> unitload t loads files into the tree.
val set : t -> path -> value option -> unitset t path sets value as new value at path.
val setm : t -> path -> string option -> value option -> intsetm t base sub value sets value as new value for all the
nodes under base that match sub (or all, if sub is
None).
Returns the number of nodes modified.
val transform : t -> string -> string -> transform_mode -> unittransform t lens file mode adds or removes (depending on
mode) the transformation of the specified lens for file.
val source : t -> path -> path optionsource t path returns the path to the node representing the
file to which path belongs, or None if path does not
represent any file.