Editfiles
From Cfwiki
There have been a bunch of suggestions for improvement of editfiles. They are:
Contents |
Suggestions for a large/complete change
- Make it a separate language from cfengine (called TextSQL), and allow its incorporation into cfengine code by using templating (see the Action Templating section of Templating Ideas)
- ...or just embed TextSQL in cfengine under the name editfiles
- David Douthitt proposes another format of embedded language in the "A General Language" section of the Talk:Editfiles Considered Harmful page
Suggestions for alteration
- Someone suggested adding another function in this post. In Tim's opinion, this assumes a format for the file, and is the main point of the suggestions for large/complete changes above.
- David Douthitt suggested "More freeform language for editing: use blocks {} and standard regular expressions", by which I mean:
- Instead of requiring a BeginGroup at the top on a single line, and EndGroup (or EndThis or EndThat) on a single line, use begin as a general start and end as a general ending (or alternately, { and }, the C braces) - and don't require these begin and end markers to be on a single line either.
- Use standard regular expressions - that is, /foo/ matches foo anywhere in the line, not a line containing "foo" - and include all of the fancy regex patterns that go with a standard regex library.
- Most of all, don't require each keyword to be on a separate line; use separators and/or line terminators.
Workarounds for current editfiles
- Jamie Wilkinson, at the top of Talk:Editfiles_Considered_Harmful, talks about using M4 over the top of editfiles.
- Tim Nelson's cfengine-masterconf solves this problem along with some others
If there is interest, I'm using a complete set of m4 macros to automate my edits. The macros coordinate with version control and use the full file replacement method I posted here, as well as the block editing method. I'm willing to post them if they'd be useful. -Rladams
Why editfiles needs improvement
Eric Sorensen explained this in his Editfiles Considered Harmful.
