In order to easily manage multiple entries in the tree, it would be useful to have a setlist
API entry, which would manage both named nodes as well as seq
ones. It could look like this:
setlist <path> <label|seq> <replace|add|merge> <value> [value [value […]]]
For example, having /files/etc/ssh/sshd_config/AcceptEnv
as:
{ "AcceptEnv"
{ "1" = "LC_*" } }
The following call:
setlist /files/etc/ssh/sshd_config/AcceptEnv seq replace LANG LC_*
would produce:
{ "AcceptEnv"
{ "1" = "LANG" }
{ "2" = "LC_*" } }
while
setlist /files/etc/ssh/sshd_config/AcceptEnv seq add LANG FOO
would result in:
{ "AcceptEnv"
{ "1" = "LC_*" }
{ "2" = "LANG" }
{ "3" = "FOO" } }
and
setlist /files/etc/ssh/sshd_config/AcceptEnv seq merge LANG LC_*
in
{ "AcceptEnv"
{ "1" = "LANG" }
{ "2" = "LC_*" } }
For non-seq
entries, we could specify the label. For example, having /files/etc/group/audio
set to:
{ "audio"
{ "password" = "x" }
{ "gid" = "29" }
{ "user" = "pulse" }
{ "user" = "rpinson" } }
we could do:
setlist /files/etc/group/audio user add foo bar
resulting in:
{ "audio"
{ "password" = "x" }
{ "gid" = "29" }
{ "user" = "pulse" }
{ "user" = "rpinson" }
{ "user" = "foo" }
{ "user" = "bar" } }
If the nodes need to be created on sublevels, you would use a slash in the label:
setlist /path/to/node entry/user replace foo bar