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 *)
32 (** Flags passed to the {!create} function. *)
35 (** A path expression.
37 Note in future we may replace this with a type-safe path constructor. *)
42 val create : string -> string option -> flag list -> t
43 (** [create root loadpath flags] creates an Augeas handle.
45 [root] is a file system path describing the location
46 of the configuration files.
48 [loadpath] is an optional colon-separated list of directories
49 which are searched for schema definitions.
51 [flags] is a list of flags. *)
54 (** [close handle] closes the handle.
56 You don't need to close handles explicitly with this function:
57 they will be finalized eventually by the garbage collector.
58 However calling this function frees up any resources used by the
59 underlying Augeas library immediately.
61 Do not use the handle after closing it. *)
63 val get : t -> path -> value option
64 (** [get t path] returns the value at [path], or [None] if there
67 val exists : t -> path -> bool
68 (** [exists t path] returns true iff there is a value at [path]. *)
70 val insert : t -> ?before:bool -> path -> string -> unit
71 (** [insert t ?before path label] inserts [label] as a sibling
72 of [path]. By default it is inserted after [path], unless
73 [~before:true] is specified. *)
75 val rm : t -> path -> int
76 (** [rm t path] removes all nodes matching [path].
78 Returns the number of nodes removed (which may be 0). *)
80 val matches : t -> path -> path list
81 (** [matches t path] returns a list of path expressions
82 of all nodes matching [path]. *)
84 val count_matches : t -> path -> int
85 (** [count_matches t path] counts the number of nodes matching
86 [path] but does not return them (see {!matches}). *)
89 (** [save t] saves all pending changes to disk. *)