[augeas-devel] Re: Difference between API's aug_match and augtool's match
David Lutterkort
lutter at redhat.com
Thu Sep 4 15:51:14 UTC 2008
On Thu, 2008-09-04 at 14:40 +0200, Free Ekanayaka wrote:
> Hi Raphaël,
>
> |--==> On Thu, 4 Sep 2008 14:29:36 +0200, "Raphaël Pinson" <raphink at gmail.com> said:
>
> [...]
>
> RP> In essence, the match command in augtool does first a aug_match call, and
> RP> then goes through the results and does an aug_get on each node and checks
> RP> that the value matches the given (optional) string (it would actually be
> RP> interesting if augtool accepted a regexp as a filter by the way).
>
> RP> This cannot be added to the API without modifying the API, which is not
> RP> acceptable, so you'd have to either rewrite what cmd_match does in your
> RP> program, or make a new API call (e.g. aug_match_filter) that would do this.
>
> I think such a new API call would be very useful.
If I ever get to actually implementing the XPath-like extensions I want
to implement, you'll get the same (and more) from aug_match by using a
path expression like '/foo/bar/baz[value() = "myvalue"]'
If you are using Augeas from a scripting language (Python/Ruby/Perl), it
should be easy enough to add an aug_match_filter as a routine in that
language - could even be added to the bindings directly.
David
More information about the augeas-devel
mailing list