Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / simplevars.aug
1 (*
2 Module: Simplevars
3   Parses simple key = value conffiles
4
5 Author: Raphael Pinson <raphink@gmail.com>
6
7 About: License
8    This file is licenced under the LGPL v2+, like the rest of Augeas.
9
10 About: Lens Usage
11    To be documented
12
13 About: Examples
14    The <Test_Simplevars> file contains various examples and tests.
15 *)
16
17 module Simplevars =
18
19 autoload xfm
20
21 (* Variable: to_comment_re
22    The regexp to match the value *)
23 let to_comment_re =
24      let to_comment_squote = /'[^\n']*'/
25   in let to_comment_dquote = /"[^\n"]*"/
26   in let to_comment_noquote = /[^\n \t'"#][^\n#]*[^\n \t#]|[^\n \t'"#]/
27   in to_comment_squote | to_comment_dquote | to_comment_noquote
28
29 (* View: entry *)
30 let entry =
31      let some_value = Sep.space_equal . store to_comment_re
32      (* Avoid ambiguity in tree by making a subtree here *)
33   in let empty_value = [del /[ \t]*=/ "="] . store ""
34   in [ Util.indent . key Rx.word
35             . (some_value? | empty_value)
36             . (Util.eol | Util.comment_eol) ]
37
38 (* View: lns *)
39 let lns = (Util.empty | Util.comment | entry)*
40
41 (* Variable: filter *)
42 let filter = incl "/etc/kernel-img.conf"
43            . incl "/etc/kerneloops.conf"
44            . incl "/etc/wgetrc"
45            . incl "/etc/zabbix/*.conf"
46            . incl "/etc/audit/auditd.conf"
47            . incl "/etc/mixerctl.conf"
48            . incl "/etc/wsconsctlctl.conf"
49            . incl "/etc/ocsinventory/ocsinventory-agent.cfg"
50
51 let xfm = transform lns filter