On Thu, 2008-07-24 at 09:23 +0200, Raphaël Pinson wrote:
> It might be useful for developers using the Augeas API to access the
> pattern that Augeas is considering for values. For example, if a dev
> created a graphical interface using Augeas, they might want to check
> the values provided by users against the regexp describing these
> values. Such a function could have a syntax like 'pattern(path)'
> 
>  pattern("/files/etc/logrotate.d/apache2/rule/file")
> => /[^,# \n\t{}]+/

This would only be possible if that query is based on the current tree,
since the pattern for a value can change depending on whether other
nodes in the tree are present or not. For example,

        let lns =  ([ key /u/ ] . [ key /b/ . store /[0-9]+/ ])
                   | ([ key /v/ ] . [ key /b/ . store /[a-z]+/ ])

Here, the regexp for the value of 'b' changes, depending on whether the
'b' node is preceded by a 'u' or by a 'v' node.

Given that, an implementation would probably be pretty hairy, and would
need to go through the motions of a 'put' operations, i.e. it could
become pretty expensive. Patches welcome, of course ;)

David



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

Reply via email to