Module Augeas

module Augeas: sig .. end

Augeas OCaml bindings


type t 

Augeas library handle.

exception Error of string

This exception is thrown when the underlying Augeas library returns an error.

type flag = 
| AugSaveBackup (*

Rename original with .augsave

*)
| AugSaveNewFile (*

Save changes to .augnew

*)
| AugTypeCheck (*

Type-check lenses

*)

Flags passed to the Augeas.create function.

type path = string 

A path expression.

Note in future we may replace this with a type-safe path constructor.

type value = string 

A value.

val create : string -> string option -> flag list -> t

create 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 -> unit

close 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 get : t -> path -> value option

get t path returns the value at path, or None if there is no value.

val exists : t -> path -> bool

exists t path returns true iff there is a value at path.

val insert : t -> ?before:bool -> path -> string -> unit

insert t ?before path label inserts label as a sibling of path. By default it is inserted after path, unless ~before:true is specified.

val rm : t -> path -> int

rm t path removes all nodes matching path.

Returns the number of nodes removed (which may be 0).

val matches : t -> path -> path list

matches t path returns a list of path expressions of all nodes matching path.

val count_matches : t -> path -> int

count_matches t path counts the number of nodes matching path but does not return them (see Augeas.matches).

val save : t -> unit

save t saves all pending changes to disk.