This C extension for the Tcl interpreter provides bindings for Augeas, a configuration-editing tool.
tcl-augeas requires Tcl 8.5 or later. It supports Tcl 9. tcl-augeas is known to build and pass the tests with Augeas 0.10 through 1.8.
The current version has been tested on the following operating systems:
- Debian 12
- Fedora 39
- FreeBSD 14.0-RELEASE
- NetBSD 10.0
- macOS 14
- OpenBSD 7.4
- openSUSE Leap 15.5
- Ubuntu 24.04
To build tcl-augeas,
you will need a C compiler, make, pkg-config, and Augeas, libxml2, and Tcl with the C headers.
Below are the commands to install the dependencies on different operating systems.
sudo apt install -y build-essentkal libaugeas-dev pkg-config tcl-devsudo dnf install -y augeas-devel gcc make pkgconfig tcl-develsudo zypper install -y augeas augeas-lenses augeas-devel gcc make pkgconfig tcl-develUse Homebrew.
brew install augeas pkg-config tcl-tksudo pkg install -y augeas libxml2 pkgconf tcl86sudo pkgin -y install augeas libxml2 pkg-config tcldoas pkg_add -I augeas libxml2 pkg-config tcl%8.6Clone this repository with Git or download and extract a tar archive. In the directory run the commands:
# BSDs, Linux distros.
./configure
# macOS with Homebrew.
./configure --with-tcl="$(brew --prefix tcl-tk)"/lib
make test
# Typical Free/NetBSD, most Linux distros.
sudo make install
# OpenBSD.
doas make installThe commands tcl-augeas provides mirror the C public API of Augeas.
::augeas::init root ?loadpath? ?flags?-> token::augeas::close token-> (nothing)::augeas::save token-> (nothing)::augeas::load token-> (nothing)::augeas::get token path-> value::augeas::set token path value-> (nothing)::augeas::setm token base sub value-> number of nodes changed::augeas::span token base->{filename {label_start label_end} {value_start value_end} {span_start span_end}}::augeas::insert token path label ?before?-> (nothing)::augeas::mv token src dst-> (nothing)::augeas::rm token path-> number of nodes removed::augeas::rename token src lbl-> number of nodes renamed::augeas::match token path-> list of matches
See the numerical values for aug_flags in augeas.h.
For example, AUG_ENABLE_SPAN is 1 << 7 or 128.
Besides missing proc arguments, tcl-augeas returns an error when
- An invalid token is given to any command that expects a token;
initreceives a non-integer forflags;initfails to create an Augeas object;savecan't save changes to disk;loadfails to load data from disk (but not when it partially succeeds);getpath matches multiple or no nodes;setpath matches multiple nodes;setmchanges no nodes;spanis called, but spans aren't enabled (through the flagAUG_ENABLE_SPANor/augeas/span);spanreceives an invalid path;insertcan't create a sibling label;rmreceives an invalid path;rmchanges no nodes;renamereceives an invalid path;renamechanges no nodes;matchreceives an invalid path;- An internal error occurs in Augeas.
An optional object-oriented API wrapper is available as the package augeas::oo.
It requires either TclOO or Snit 2.
The former ships with Tcl ≥ 8.6; the latter is part of Tcllib.
If both are available, TclOO is used.
::augeas::oo::new root ?loadpath? ?flags?->objName$objName destroy-> (nothing)$objName save-> (nothing)$objName load-> (nothing)$objName get path->value$objName set path value-> (nothing)$objName setm base sub value-> number of nodes changed$objName span base->{filename {label_start label_end} {value_start value_end} {span_start span_end}}$objName insert path label ?before?-> (nothing)$objName mv src dst-> (nothing)$objName rm path-> number of nodes removed$objName rename src lbl-> number of nodes renamed$objName match path-> list of matches
::augeas::rm $token /files ;# or /files/path
::augeas::load $token::augeas::get $token /augeas/errorMIT.
See the file LICENSE.
configure is generated using GNU Autoconf.
acinclude.m4, configure.ac, Makefile.in, and pkgIndex.tcl.in are derived from the
Sample TEA Extension.
See the file tea-license.terms for the license.
The files in tclconfig/ come from the
tclconfig repository.
See tclconfig/license.terms.