1 (** Augeas OCaml bindings *)
2 (* Copyright (C) 2008 Red Hat Inc., Richard W.M. Jones
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 * $Id: augeas.mli,v 1.2 2008/05/06 10:48:20 rjones Exp $
22 (** Augeas library handle. *)
24 exception Error of string
25 (** This exception is thrown when the underlying Augeas library
29 | AugSaveBackup (** Rename original with .augsave *)
30 | AugSaveNewFile (** Save changes to .augnew *)
31 | AugTypeCheck (** Type-check lenses *)
35 (** Flags passed to the {!create} function. *)
38 (** A path expression.
40 Note in future we may replace this with a type-safe path constructor. *)
45 val create : string -> string option -> flag list -> t
46 (** [create root loadpath flags] creates an Augeas handle.
48 [root] is a file system path describing the location
49 of the configuration files.
51 [loadpath] is an optional colon-separated list of directories
52 which are searched for schema definitions.
54 [flags] is a list of flags. *)
57 (** [close handle] closes the handle.
59 You don't need to close handles explicitly with this function:
60 they will be finalized eventually by the garbage collector.
61 However calling this function frees up any resources used by the
62 underlying Augeas library immediately.
64 Do not use the handle after closing it. *)
66 val get : t -> path -> value option
67 (** [get t path] returns the value at [path], or [None] if there
70 val exists : t -> path -> bool
71 (** [exists t path] returns true iff there is a value at [path]. *)
73 val insert : t -> ?before:bool -> path -> string -> unit
74 (** [insert t ?before path label] inserts [label] as a sibling
75 of [path]. By default it is inserted after [path], unless
76 [~before:true] is specified. *)
78 val rm : t -> path -> int
79 (** [rm t path] removes all nodes matching [path].
81 Returns the number of nodes removed (which may be 0). *)
83 val matches : t -> path -> path list
84 (** [matches t path] returns a list of path expressions
85 of all nodes matching [path]. *)
87 val count_matches : t -> path -> int
88 (** [count_matches t path] counts the number of nodes matching
89 [path] but does not return them (see {!matches}). *)
92 (** [save t] saves all pending changes to disk. *)
95 (** [load t] loads files into the tree. *)