5 Author: David Lutterkort <lutter@redhat.com>
8 This lens tries to keep as close as possible to `man 5 aliases` where possible.
11 This file is licenced under the LGPL v2+, like the rest of Augeas.
16 About: Configuration files
17 This lens applies to /etc/aliases.
20 The <Test_Aliases> file contains various examples and tests.
26 (************************************************************************
27 * Group: USEFUL PRIMITIVES
28 *************************************************************************)
30 (* Group: basic tokens *)
33 let word = /[^|", \t\n]+/
35 let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)
38 * a command can contain spaces, if enclosed in double quotes, the case
39 * without spaces is taken care with <word>
41 let command = /(\|([^", \t\n]+|"[^"\n]+"))|("\|[^"\n]+")/
43 (* Group: Comments and empty lines *)
48 let comment = Util.comment
50 let empty = Util.empty
52 (* Group: separators *)
54 * Separation between the alias and it's destinations
56 let colon = del /[ \t]*:[ \t]*/ ":\t"
58 * Separation between multiple destinations
60 let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", "
65 * Can be either a word (no spaces included) or a command with spaces
67 let destination = ( word | command )
70 * List of destinations
72 let value_list = Build.opt_list ([ label "value" . store destination]) comma
75 * a name with one or more destinations
77 let alias = [ seq "alias" .
78 [ label "name" . store name ] . colon .
83 let lns = (comment | empty | alias)*
85 let xfm = transform lns (incl "/etc/aliases")
87 (* Local Variables: *)