X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=augeas.mli;h=327dc022830681eb5227e989e3a3a012dfbb5d19;hb=2ccf1e5b2a7e4ba23fc2f81e1bcdcab56e8fb9f6;hp=1123f059b4cea84a871f8d72ee6974302e0d5a9a;hpb=d92842594f602cc60b199b7377862a10798dbb7a;p=ocaml-augeas.git diff --git a/augeas.mli b/augeas.mli index 1123f05..327dc02 100644 --- a/augeas.mli +++ b/augeas.mli @@ -21,16 +21,46 @@ 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 *) + | AugNoStdinc + | AugSaveNoop + | AugNoLoad (** Flags passed to the {!create} function. *) +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 int + (** Possible error codes. *) + +type transform_mode = + | Include + | Exclude + (** The operation mode for the {!transform} function. *) + +exception Error of error_code * string * string * string + (** This exception is thrown when the underlying Augeas library + returns an error. The tuple represents: + - the Augeas error code + - the ocaml-augeas error string + - the human-readable explanation of the Augeas error, if available + - a string with details of the Augeas error + *) + type path = string (** A path expression. @@ -81,5 +111,19 @@ 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 {!matches}). *) + val save : t -> unit (** [save t] saves all pending changes to disk. *) + +val load : t -> unit + (** [load t] loads files into the tree. *) + +val set : t -> path -> value option -> unit + (** [set t path] sets [value] as new value at [path]. *) + +val transform : t -> string -> string -> transform_mode -> unit + (** [transform t lens file mode] adds or removes (depending on + [mode]) the transformation of the specified [lens] for [file]. *)