chickadee » augeas » aug-init

aug-init #!key root loadpath (flags '())procedure

Initializes the Augeas library and returns an opaque augeus record object which you pass to the other API calls.

On failure, raises an error. Unlike the other API calls, this is currently a generic exception, not an (exn augeas ...).

Optional keywords:

A string representing the filesystem root. If omitted or #f, uses the environment variable AUGEAS_ROOT, or failing that, "/".
A colon-separated list of directories to search for modules. May be omitted or #f. This is in addition to the standard load path and the env var AUGEAS_LENS_LIB.
A list of flags (see below).

Flags is a list containing at most one of the save- flags:

save-overwriteOverwrite the original file (the default behavior)
save-backupCopy the original file to file.augsave, then overwrite the original file
save-newfileSave changes into file.augnew; do not overwrite original file
save-noopMake save a no-op process, just record what would have changed into /augeas/events/saved

and any of these flags:

type-checkTypecheck lenses; very expensive
no-stdincDo not search the builtin default directories for modules
no-loadDo not load the tree of files
no-module-autoloadDo not autoload modules from the search path
enable-spanLoad span positions for nodes; required if using aug-span


;; Init Augeas and load all recognized files from "/",
;; along with all available modules (lenses).
(define a (aug-init))

;; Init Augeas and load all recognized files from ./root, 
;; along with all available lenses.
(define a (aug-init root: "./root"))

;; Extremely quick startup, but you have to set up /augeas/load/* manually
;; (see the Augeas docs).  Will copy original file with .augsave extension
;; before modifying it.  Uses / as the root, assuming AUGEAS_ROOT is not set.
(define a (aug-init flags: '(save-backup no-load no-module-autoload)))