[augeas-devel] Representing and setting a null key
Matt Palmer
matt at anchor.net.au
Tue Jul 28 03:50:02 UTC 2009
I have a lens that is trying to parse a list of strings, which are a mix of
just values and key/value pairs, and I'd like to turn that into a list. For
example:
append key=val something else foo=bar
Should turn into:
append/key val
append/(none)[1] something
append/(none)[2] else
append/foo bar
By leaving the key unspecified in the lens, I can produce this exact tree,
and that's cool (well, I'd like it if "something" and "else" were keys
rather than values, but I understand why that isn't practical).
There are two problems I'm stuck on, though:
1) How do I specify the null key in my parsing tests? I've tried many
variations:
{ (none) = "something" }
{ = "something" }
{ (null) = "something" }
{ none = "something" }
{ "something" }
And so on. Nothing I've thought up yet does the trick (most of them are
syntax errors, a few just do the wrong thing).
2) How do I represent the null key in my "set" commands? A trailing slash
and using an index both fail:
set "/append/" "notsoempty" => "garbage at end of path expression"
set "/append/[1]" "notsoempty" => "empty name"
In case anyone's curious and hasn't worked it out, I'm writing a lens for
{pxe,iso,sys}linux files, which I'll release if I can ever get the bloody
thing working.
Any suggestions (either as to my direct problem, or alternate suggestions
for representing the data I have in a sane tree format) greatly appreciated.
--
Matt Palmer - Systems Administrator
A view into the Anchor Engineroom: http://anchor.com.au/blog/
Web Hosting Knowledgebase: http://anchor.com.au/wiki/
Anchor Systems Pty Ltd - Hosting Heavyweights
W: http://www.anchor.com.u - E: support at anchor.com.au
Phone: 1300 883 979 - Fax: 02 8296 5199
More information about the augeas-devel
mailing list