Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / rsyncd.aug
1 (* Rsyncd module for Augeas
2    Author: Marc Fournier <marc.fournier@camptocamp.com>
3
4   Reference: man rsyncd.conf(5)
5
6 *)
7
8 module Rsyncd =
9   autoload xfm
10
11 (************************************************************************
12  * INI File settings
13  *************************************************************************)
14 let comment    = IniFile.comment IniFile.comment_re "#"
15 let sep        = IniFile.sep IniFile.sep_re IniFile.sep_default
16 let indent     = del /[ \t]*/ "  "
17
18 (* Import useful INI File primitives *)
19 let eol        = IniFile.eol
20 let empty      = IniFile.empty
21 let sto_to_comment
22                = Util.del_opt_ws " "
23                . store /[^;# \t\n][^;#\n]*[^;# \t\n]|[^;# \t\n]/
24
25
26 (************************************************************************
27  *                        ENTRY
28  * rsyncd.conf allows indented entries, but by default entries outside
29  * sections are unindented
30  *************************************************************************)
31 let entry_re   = /[A-Za-z0-9_.-][A-Za-z0-9 _.-]*[A-Za-z0-9_.-]/
32
33 let entry      = IniFile.indented_entry entry_re sep comment
34
35 (************************************************************************
36  *                        RECORD & TITLE
37  * We use IniFile.title_label because there can be entries
38  * outside of sections whose labels would conflict with section names
39  *************************************************************************)
40 let title   = IniFile.indented_title ( IniFile.record_re - ".anon" )
41 let record  = IniFile.record title entry
42
43 let record_anon = [ label ".anon" . ( entry | empty )+ ]
44
45 (************************************************************************
46  *                        LENS & FILTER
47  * There can be entries before any section
48  * IniFile.entry includes comment management, so we just pass entry to lns
49  *************************************************************************)
50 let lns     = record_anon? . record*
51
52 let filter = (incl "/etc/rsyncd.conf")
53
54 let xfm = transform lns filter