Yaroslav Halchenko wrote:

Mark Burgess wrote:

> The reason is that "assign value" assumes a particular format of the
> file you are editing. It is not general enough to warrant its own
> function. Perhaps we can think of something else.

There are plenty of current editfiles functions that assume a particular
format of the edited file. For example, all the HashCommentLines.*
functions. This has come up many times before. I think we just have to
accept the fact that Mark does not like it. :-)

In any case, this has been what I have been doing to solve this problem
recently. It's still two lines, but I think it is more readable than
anything else I have seen.

    DeleteLinesMatching "^somevar = .*$"
    AppendIfNoSuchLine "somevar = somevalue"

You have to have some knowledge of the contents of the file you are
editing, but in practice this is not really a problem.


_______________________________________________
Help-cfengine mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-cfengine

Reply via email to