Aliases

Parses /etc/aliases

Author: David Lutterkort lut.nosp@m.ter@redha.nosp@m.t.com

Summary
AliasesParses /etc/aliases
ReferenceThis lens tries to keep as close as possible to `man 5 aliases` where possible.
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageSee lns.
Configuration filesThis lens applies to /etc/aliases.
ExamplesThe Test_Aliases file contains various examples and tests.
USEFUL PRIMITIVES
basic tokens
word
name
commanda 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
colonSeparation between the alias and it’s destinations
commaSeparation between multiple destinations
alias
destinationCan be either a word (no spaces included) or a command with spaces
value_listList of destinations
aliasa name with one or more destinations
lns

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

let word = /[^|", \t\n]+/

name

let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)

command

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

Comments and empty lines

eol

let eol = Util.eol

comment

let comment = Util.comment

empty

let empty = Util.empty

separators

colon

let colon = del /[ \t]*:[ \t]*/ ":\t"

Separation between the alias and it’s destinations

comma

let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", "

Separation between multiple destinations

alias

destination

let destination = ( word | command )

Can be either a word (no spaces included) or a command with spaces

value_list

let value_list = Build.opt_list ([ label "value" . store destination]) comma

List of destinations

alias

let alias = [ seq "alias" . [ label "name" . store name ] . colon . value_list ] . eol

a name with one or more destinations

lns

let lns = (comment | empty | alias)*
let lns = (comment | empty | alias)*
Provides unit tests and examples for the Aliases lens.
let word = /[^|", \t\n]+/
let name = /([^ \t\n#:|@]+|"[^"|\n]*")/ (* " make emacs calm down *)
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 eol = Util.eol
let comment = Util.comment
let empty = Util.empty
let colon = del /[ \t]*:[ \t]*/ ":\t"
Separation between the alias and it’s destinations
let comma = del /[ \t]*,[ \t]*(\n[ \t]+)?/ ", "
Separation between multiple destinations
let destination = ( word | command )
Can be either a word (no spaces included) or a command with spaces
let value_list = Build.opt_list ([ label "value" . store destination]) comma
List of destinations
let alias = [ seq "alias" . [ label "name" . store name ] . colon . value_list ] . eol
a name with one or more destinations
Close