On Tue, 2008-07-29 at 13:04 +0200, Raphaël Pinson wrote:
> There's a few things to note here:
> * mv works ! Thank you David :)

Cool .. then I'll commit it upstream.

> * save works but is not happy :(

That seems to be related to something else .. I could not reproduce the
problem you were having. Do you have any other lenses in the directory
where CommentTest lives ? 

> * "field=toto" got moved from 1st place to 2nd placed when it got
> commented. This is a side effect to this (un)commenting method I
> hadn't considered.

Yeah, if you want to avoid that, you have to insert the new node
beforehand, e.g.

  ins .field after /files/commenttest/field[1]
  mv /files/commenttest/field[1] /files/commenttest/.field

New nodes are always added at the end (the same is true for 'set')

> * dealing with key in the lens is quite tricky. While it's possible to
> declare a c_key function, it will only take a string, since the
> contents of Util.del_str kw cannot be assigned to label currently.

Yeah, in its current form, Augeas only allows exactly one primitive that
sets the label for a tree node (either key, label or seq) What's missing
is forming tree labels from multiple such lenses so that you can say

        [ del /#[ \t]*/ "#" . label "." . key /[a-z]+/ . ... ]
        
to prepend a '.' to the key parsed from the file. Initially, I marked
that as an error, simply to be on the safe side. I now think it should
be made possible, but it would require a fair amount of surgery in the
internals (mostly lens.c, get.c, and put.c)

David


_______________________________________________
augeas-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/augeas-devel

Reply via email to