Parses /etc/aliases
Author: David Lutterkort lut@redha t.com ter
Aliases | Parses /etc/aliases |
Reference | This lens tries to keep as close as possible to `man 5 aliases` where possible. |
License | This file is licenced under the LGPL v2+, like the rest of Augeas. |
Lens Usage | See lns. |
Configuration files | This lens applies to /etc/aliases. |
Examples | The Test_Aliases file contains various examples and tests. |
USEFUL PRIMITIVES | |
basic tokens | |
word | |
name | |
command | a command can contain spaces, if enclosed in double quotes, the case without spaces is taken care with word |
Comments and empty lines | |
eol | |
comment | |
empty | |
separators | |
colon | Separation between the alias and it’s destinations |
comma | Separation between multiple destinations |
alias | |
destination | Can be either a word (no spaces included) or a command with spaces |
value_list | List of destinations |
alias | a name with one or more destinations |
lns |
See lns.
The Test_Aliases file contains various examples and tests.
let command = /(\|([^", \t\n]+|"[^"\n]+"))|("\|[^"\n]+")/
a command can contain spaces, if enclosed in double quotes, the case without spaces is taken care with word
let lns = (comment | empty | alias)*
let word = /[^|", \t\n]+/
let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)
a command can contain spaces, if enclosed in double quotes, the case without spaces is taken care with word
let command = /(\|([^", \t\n]+|"[^"\n]+"))|("\|[^"\n]+")/
let eol = Util.eol
let comment = Util.comment
let empty = Util.empty
Separation between the alias and it’s destinations
let colon = del /[ \t]*:[ \t]*/ ":\t"
Separation between multiple destinations
let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", "
Can be either a word (no spaces included) or a command with spaces
let destination = ( word | command )
List of destinations
let value_list = Build.opt_list ([ label "value" . store destination]) comma
a name with one or more destinations
let alias = [ seq "alias" . [ label "name" . store name ] . colon . value_list ] . eol