Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / postfix_virtual.aug
1 (*
2 Module: Postfix_Virtual
3   Parses /etc/postfix/virtual
4
5 Author: Raphael Pinson <raphael.pinson@camptocamp.com>
6
7 About: Reference
8   This lens tries to keep as close as possible to `man 5 virtual` where possible.
9
10 About: License
11    This file is licenced under the LGPL v2+, like the rest of Augeas.
12
13 About: Lens Usage
14    To be documented
15
16 About: Configuration files
17    This lens applies to /etc/postfix/virtual. See <filter>.
18
19 About: Examples
20    The <Test_Postfix_Virtual> file contains various examples and tests.
21 *)
22
23 module Postfix_Virtual =
24
25 autoload xfm
26
27 (* Variable: space_or_eol_re *)
28 let space_or_eol_re = /([ \t]*\n)?[ \t]+/
29
30 (* View: space_or_eol *)
31 let space_or_eol (sep:regexp) (default:string) =
32   del (space_or_eol_re? . sep . space_or_eol_re?) default
33
34 (* View: word *)
35 let word = store /[A-Za-z0-9@\*.+=_-]+/
36
37 (* View: comma *)
38 let comma = space_or_eol "," ", "
39
40 (* View: destination *)
41 let destination = [ label "destination" . word ]
42
43 (* View: record *)
44 let record =
45   let destinations = Build.opt_list destination comma
46   in [ label "pattern" . word
47      . space_or_eol Rx.space " " . destinations
48      . Util.eol ]
49
50 (* View: lns *)
51 let lns = (Util.empty | Util.comment | record)*
52
53 (* Variable: filter *)
54 let filter = incl "/etc/postfix/virtual"
55            . incl "/usr/local/etc/postfix/virtual"
56
57 let xfm = transform lns filter