ucl reads and rewrites Universal Configuration Language files with
libucl(3), the private library pkg(8) links, so what sysconf reads is
what pkg reads. Each file is parsed on its own and every scalar is
addressed by its dotted path (FreeBSD-ports.enabled); the last file
to define a path is authoritative. A write changes only the one
statement, in the file's own separator, terminator, quoting, and
boolean style, then re-parses the result with libucl and refuses the
write unless the parsed contents differ in exactly the requested key.
Removing the last key of an object removes the object.
Arrays are leaves, read back as compact JSON. name+=word and
name-=word on an array add and strike elements. Under an array a
path component is an index, as uclcmd(1) spells it: name.i reaches
one element (name.i=value sets it, name.i+=word edits it, -x name.i
strikes it), name.i.j reaches into a nested array, and name.# is the
count (name.#=value appends). A negative index counts from the end.
Under an object the same component is a key, so a key named 404 or #
or * is addressed as written. A key the library cannot take bare is
written quoted; a file that leaves such a key bare, as uclcmd(1) may,
is still read. An element is added or taken out on its own line in
the style of its neighbours, a trailing comment going with a struck
line as a sysrc(8) removal would take it.
pkg is ucl over the files pkg(8) reads: /etc/pkg/*.conf,
/usr/local/etc/pkg.conf, and /usr/local/etc/pkg/repos/*.conf. Files
under /etc/pkg are read-only; a repository key found there is
overridden in /usr/local/etc/pkg/repos/FreeBSD.conf, created in the
base file's style, and a global key goes to pkg.conf. pkg config
only reads, and pkg repositories enable/disable records a side file
under the package database, so neither covers sysconf pkg ability.
The pkg keyword makes `p' ambiguous with poudriere; pk and po select
them.