[augeas-devel] [PATCH 1/1] Added 'setm' function.

Frederik Wagner fnerdwq at googlemail.com
Sun Mar 21 10:11:42 UTC 2010


On Tue, Mar 16, 2010 at 11:42 PM, David Lutterkort <lutter at redhat.com> wrote:
> Hi Frederik,
>
> On Tue, 2010-03-16 at 23:04 +0100, Frederik Wagner wrote:
>> On Tue, Mar 16, 2010 at 10:38 PM, David Lutterkort <lutter at redhat.com> wrote:
>> > On Tue, 2010-03-16 at 22:04 +0100, Frederik Wagner wrote:
>> >> This function sets multiple elements to a node set.
>> >
>> > This patch looks fine to me; I am curious though what you thought of
>> > adding 'set multiple' functionality to libaugeas itself, and the way the
>> > patch I sent works.
>> >
>>
>> oh, I didn't yet see that one (hanging behind digging through the
>> mails:), I just send what I already had.
>>
>> We have to be carefull about the features of the 'setm' function now:
>> What I send is the possibility to  (e.g.) append multiple values (from
>> an array) to a node set, like users to a group. You send an idea for a
>> - let's call it - the 'set_all' function. Should we mix that
>> functionality?
>
> No - I didn't look at the patch carefully enough. For the 'set from an
> array' functionality, it's best to do that in Ruby. We need to make sure
> that the names for those two functions does not collide though.
>
> You could add what you did in the existing set method:
>      * rename the set in ext/augeas/_augeas.c to set_internal
>      * add to lib/augeas.rb
>
>        def set(path, *values)
>          values.flatten.all { |v| set_internal(path, v) }
>        end
>
> With that, you can say 'aug.set(path, "v")' or 'aug.set(path, "v1",
> "v2")' or 'aug.set(path, ["v1", "v2"])'

just send the patches for this, so forget about this earlier patch for 'setm'.

Next I will have a look at your patch and suggestion for the
other/real 'setm' function.

Bye
Frederik

>
> David
>
>
> _______________________________________________
> augeas-devel mailing list
> augeas-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/augeas-devel
>




More information about the augeas-devel mailing list