/usr/share/augeas/lenses/dist/build.aug is in augeas-lenses 0.10.0-0ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | (*
Module: Build
Generic functions to build lenses
Author: Raphael Pinson <raphink@gmail.com>
About: License
This file is licensed under the LGPLv2+, like the rest of Augeas.
About: Reference
This file provides generic functions to build Augeas lenses
*)
module Build =
let eol = Util.eol
(************************************************************************
* Group: GENERIC CONSTRUCTIONS
************************************************************************)
(************************************************************************
* View: brackets
* Put a lens inside brackets
*
* Parameters:
* l:lens - the left bracket lens
* r: lens - the right bracket lens
* lns:lens - the lens to put inside brackets
************************************************************************)
let brackets (l:lens) (r:lens) (lns:lens) = l . lns . r
(************************************************************************
* Group: LIST CONSTRUCTIONS
************************************************************************)
(************************************************************************
* View: list
* Build a list of identical lenses separated with a given separator
* (at least 2 elements)
*
* Parameters:
* lns:lens - the lens to repeat in the list
* sep:lens - the separator lens, which can be taken from the <Sep> module
************************************************************************)
let list (lns:lens) (sep:lens) = lns . ( sep . lns )+
(************************************************************************
* View: opt_list
* Same as <list>, but there might be only one element in the list
*
* Parameters:
* lns:lens - the lens to repeat in the list
* sep:lens - the separator lens, which can be taken from the <Sep> module
************************************************************************)
let opt_list (lns:lens) (sep:lens) = lns . ( sep . lns )*
(************************************************************************
* Group: LABEL OPERATIONS
************************************************************************)
(************************************************************************
* View: xchg
* Replace a pattern with a different label in the tree,
* thus emulating a key but allowing to replace the keyword
* with a different value than matched
*
* Parameters:
* m:regexp - the pattern to match
* d:string - the default value when a node in created
* l:string - the label to apply for such nodes
************************************************************************)
let xchg (m:regexp) (d:string) (l:string) = del m d . label l
(************************************************************************
* View: xchgs
* Same as <xchg>, but the pattern is the default string
*
* Parameters:
* m:string - the string to replace, also used as default
* l:string - the label to apply for such nodes
************************************************************************)
let xchgs (m:string) (l:string) = xchg m m l
(************************************************************************
* Group: SUBNODE CONSTRUCTIONS
************************************************************************)
(************************************************************************
* View: key_value_line
* A subnode with a keyword, a separator and a storing lens,
* and an end of line
*
* Parameters:
* kw:regexp - the pattern to match as key
* sep:lens - the separator lens, which can be taken from the <Sep> module
* sto:lens - the storing lens
************************************************************************)
let key_value_line (kw:regexp) (sep:lens) (sto:lens) =
[ key kw . sep . sto . eol ]
(************************************************************************
* View: key_value_line_comment
* Same as <key_value_line>, but allows to have a comment in the end of a line
* and an end of line
*
* Parameters:
* kw:regexp - the pattern to match as key
* sep:lens - the separator lens, which can be taken from the <Sep> module
* sto:lens - the storing lens
* comment:lens - the comment lens, which can be taken from <Util>
************************************************************************)
let key_value_line_comment (kw:regexp) (sep:lens) (sto:lens) (comment:lens) =
[ key kw . sep . sto . (eol|comment) ]
(************************************************************************
* View: key_value
* Same as <key_value_line>, but does not end with an end of line
*
* Parameters:
* kw:regexp - the pattern to match as key
* sep:lens - the separator lens, which can be taken from the <Sep> module
* sto:lens - the storing lens
************************************************************************)
let key_value (kw: regexp) (sep:lens) (sto:lens) =
[ key kw . sep . sto ]
(************************************************************************
* View: key_ws_value
*
* Store a key/value pair where key and value are separated by whitespace
* and the value goes to the end of the line. Leading and trailing
* whitespace is stripped from the value. The end of line is consumed by
* this lens
*
* Parameters:
* kw:regexp - the pattern to match as key
************************************************************************)
let key_ws_value (kw:regexp) =
key_value_line kw Util.del_ws_spc (store Rx.space_in)
(************************************************************************
* View: flag
* A simple flag subnode, consisting of a single key
*
* Parameters:
* kw:regexp - the pattern to match as key
************************************************************************)
let flag (kw:regexp) = [ key kw ]
(************************************************************************
* View: flag_line
* A simple flag line, consisting of a single key
*
* Parameters:
* kw:regexp - the pattern to match as key
************************************************************************)
let flag_line (kw:regexp) = [ key kw . eol ]
|