/usr/share/augeas/lenses/dist
NameSizeModeActions
tests/-0755rm
access.aug36690644editdlrm
activemq_conf.aug15090644editdlrm
activemq_xml.aug8640644editdlrm
afs_cellalias.aug16020644editdlrm
aliases.aug22310644editdlrm
anaconda.aug7750644editdlrm
anacron.aug25450644editdlrm
approx.aug12860644editdlrm
aptcacherngsecurity.aug7260644editdlrm
aptconf.aug39890644editdlrm
aptpreferences.aug18310644editdlrm
aptsources.aug20230644editdlrm
apt_update_manager.aug11350644editdlrm
authinfo2.aug14760644editdlrm
authorized_keys.aug18830644editdlrm
authselectpam.aug37840644editdlrm
automaster.aug33910644editdlrm
automounter.aug41480644editdlrm
avahi.aug14170644editdlrm
backuppchosts.aug10140644editdlrm
bbhosts.aug43420644editdlrm
bootconf.aug37360644editdlrm
build.aug170450644editdlrm
cachefilesd.aug20510644editdlrm
carbon.aug15740644editdlrm
ceph.aug7190644editdlrm
cgconfig.aug34470644editdlrm
cgrules.aug24320644editdlrm
channels.aug39290644editdlrm
chrony.aug139820644editdlrm
clamav.aug17160644editdlrm
cmdline.aug5000644editdlrm
cobblermodules.aug3980644editdlrm
cobblersettings.aug22950644editdlrm
collectd.aug8690644editdlrm
cpanel.aug8240644editdlrm
cron.aug41430644editdlrm
cron_user.aug12900644editdlrm
crypttab.aug31510644editdlrm
csv.aug12120644editdlrm
cups.aug4590644editdlrm
cyrus_imapd.aug15460644editdlrm
darkice.aug7730644editdlrm
debctrl.aug37010644editdlrm
desktop.aug14220644editdlrm
devfsrules.aug6190644editdlrm
device_map.aug6200644editdlrm
dhclient.aug68500644editdlrm
dhcpd.aug213790644editdlrm
dnsmasq.aug22090644editdlrm
dns_zone.aug29630644editdlrm
dovecot.aug40730644editdlrm
dpkg.aug28510644editdlrm
dput.aug22130644editdlrm
erlang.aug44320644editdlrm
ethers.aug6630644editdlrm
exports.aug24240644editdlrm
fail2ban.aug18350644editdlrm
fai_diskconfig.aug95020644editdlrm
fonts.aug8190644editdlrm
fstab.aug12570644editdlrm
fuse.aug8710644editdlrm
gdm.aug18410644editdlrm
getcap.aug16100644editdlrm
group.aug17030644editdlrm
grub.aug113110644editdlrm
grubenv.aug5080644editdlrm
gshadow.aug22400644editdlrm
gtkbookmarks.aug8550644editdlrm
hostname.aug4350644editdlrm
hosts.aug4850644editdlrm
hosts_access.aug44260644editdlrm
host_conf.aug19410644editdlrm
htpasswd.aug10430644editdlrm
httpd.aug75270644editdlrm
inetd.aug63650644editdlrm
inifile.aug158590644editdlrm
inittab.aug7800644editdlrm
inputrc.aug16620644editdlrm
interfaces.aug47330644editdlrm
iproute2.aug3230644editdlrm
iptables.aug27030644editdlrm
iscsid.aug6840644editdlrm
jaas.aug16120644editdlrm
jettyrealm.aug15520644editdlrm
jmxaccess.aug13860644editdlrm
jmxpassword.aug13750644editdlrm
json.aug21980644editdlrm
kdump.aug29770644editdlrm
keepalived.aug109580644editdlrm
known_hosts.aug19790644editdlrm
koji.aug8980644editdlrm
krb5.aug71490644editdlrm
ldif.aug78330644editdlrm
ldso.aug10850644editdlrm
lightdm.aug17930644editdlrm
limits.aug20660644editdlrm
login_defs.aug6150644editdlrm
logrotate.aug43330644editdlrm
logwatch.aug14730644editdlrm
lokkit.aug22160644editdlrm
lvm.aug20790644editdlrm
mailscanner.aug16990644editdlrm
mailscanner_rules.aug29110644editdlrm
masterpasswd.aug44680644editdlrm
mcollective.aug11120644editdlrm
mdadm_conf.aug102890644editdlrm
memcached.aug12720644editdlrm
mke2fs.aug64360644editdlrm
modprobe.aug34200644editdlrm
modules.aug7410644editdlrm
modules_conf.aug10680644editdlrm
mongodbserver.aug12010644editdlrm
monit.aug21820644editdlrm
multipath.aug43110644editdlrm
mysql.aug19940644editdlrm
nagioscfg.aug21380644editdlrm
nagiosobjects.aug16040644editdlrm
netmasks.aug17320644editdlrm
networkmanager.aug22330644editdlrm
networks.aug11160644editdlrm
nginx.aug37400644editdlrm
nrpe.aug18270644editdlrm
nslcd.aug101110644editdlrm
nsswitch.aug23860644editdlrm
ntp.aug54190644editdlrm
ntpd.aug48610644editdlrm
odbc.aug14500644editdlrm
opendkim.aug31740644editdlrm
openshift_config.aug25240644editdlrm
openshift_http.aug10520644editdlrm
openshift_quickstarts.aug10440644editdlrm
openvpn.aug228170644editdlrm
oz.aug13840644editdlrm
pagekite.aug26630644editdlrm
pam.aug26370644editdlrm
pamconf.aug12560644editdlrm
passwd.aug36090644editdlrm
pbuilder.aug6380644editdlrm
pgbouncer.aug14620644editdlrm
pg_hba.aug30430644editdlrm
php.aug23930644editdlrm
phpvars.aug39470644editdlrm
postfix_access.aug7710644editdlrm
postfix_main.aug15550644editdlrm
postfix_master.aug19500644editdlrm
postfix_passwordmap.aug13120644editdlrm
postfix_sasl_smtpd.aug6970644editdlrm
postfix_transport.aug15140644editdlrm
postfix_virtual.aug13470644editdlrm
postgresql.aug21520644editdlrm
properties.aug23570644editdlrm
protocols.aug10800644editdlrm
puppet.aug15580644editdlrm
puppetfile.aug23270644editdlrm
puppetfileserver.aug31900644editdlrm
puppet_auth.aug20010644editdlrm
pylonspaste.aug23590644editdlrm
pythonpaste.aug20350644editdlrm
qpid.aug6700644editdlrm
quote.aug68710644editdlrm
rabbitmq.aug48040644editdlrm
radicale.aug15180644editdlrm
rancid.aug9270644editdlrm
redis.aug64390644editdlrm
reprepro_uploaders.aug56040644editdlrm
resolv.aug40820644editdlrm
rhsm.aug11300644editdlrm
rmt.aug7880644editdlrm
rsyncd.aug20170644editdlrm
rsyslog.aug33440644editdlrm
rtadvd.aug8540644editdlrm
rx.aug43030644editdlrm
samba.aug17550644editdlrm
schroot.aug18320644editdlrm
securetty.aug4500644editdlrm
semanage.aug8590644editdlrm
sep.aug13060644editdlrm
services.aug28870644editdlrm
shadow.aug24040644editdlrm
shells.aug7450644editdlrm
shellvars.aug123110644editdlrm
shellvars_list.aug17790644editdlrm
simplelines.aug11550644editdlrm
simplevars.aug14380644editdlrm
sip_conf.aug16510644editdlrm
slapd.aug53270644editdlrm
smbusers.aug7810644editdlrm
solaris_system.aug32280644editdlrm
soma.aug11670644editdlrm
spacevars.aug14490644editdlrm
splunk.aug16770644editdlrm
squid.aug163300644editdlrm
ssh.aug44930644editdlrm
sshd.aug42480644editdlrm
sssd.aug8610644editdlrm
star.aug9410644editdlrm
strongswan.aug16710644editdlrm
stunnel.aug22600644editdlrm
subversion.aug28170644editdlrm
sudoers.aug205570644editdlrm
sysconfig.aug25500644editdlrm
sysconfig_route.aug26150644editdlrm
sysctl.aug9230644editdlrm
syslog.aug75010644editdlrm
systemd.aug61540644editdlrm
termcap.aug10500644editdlrm
thttpd.aug13450644editdlrm
tinc.aug11030644editdlrm
tmpfiles.aug31570644editdlrm
toml.aug41750644editdlrm
trapperkeeper.aug41100644editdlrm
tuned.aug3870644editdlrm
up2date.aug22640644editdlrm
updatedb.aug11590644editdlrm
util.aug49630644editdlrm
vfstab.aug17560644editdlrm
vmware_config.aug7020644editdlrm
vsftpd.aug27850644editdlrm
webmin.aug12570644editdlrm
wine.aug19660644editdlrm
xendconfsxp.aug10970644editdlrm
xinetd.aug41200644editdlrm
xml.aug64810644editdlrm
xorg.aug106790644editdlrm
xymon.aug23140644editdlrm
xymon_alerting.aug62590644editdlrm
yaml.aug15810644editdlrm
yum.aug22400644editdlrm
Edit: /usr/share/augeas/lenses/dist/inifile.aug (15859B)
(* Module: IniFile Generic module to create INI files lenses Author: Raphael Pinson About: License This file is licensed under the LGPL v2+, like the rest of Augeas. About: TODO Things to add in the future - Support double quotes in value About: Lens usage This lens is made to provide generic primitives to construct INI File lenses. See , , or for examples of real life lenses using it. About: Examples The file contains various examples and tests. *) module IniFile = (************************************************************************ * Group: USEFUL PRIMITIVES *************************************************************************) (* Group: Internal primitives *) (* Variable: eol End of line, inherited from *) let eol = Util.doseol (* Group: Separators *) (* Variable: sep Generic separator Parameters: pat:regexp - the pattern to delete default:string - the default string to use *) let sep (pat:regexp) (default:string) = Sep.opt_space . del pat default (* Variable: sep_noindent Generic separator, no indentation Parameters: pat:regexp - the pattern to delete default:string - the default string to use *) let sep_noindent (pat:regexp) (default:string) = del pat default (* Variable: sep_re The default regexp for a separator *) let sep_re = /[=:]/ (* Variable: sep_default The default separator value *) let sep_default = "=" (* Group: Stores *) (* Variable: sto_to_eol Store until end of line *) let sto_to_eol = Sep.opt_space . store Rx.space_in (* Variable: to_comment_re Regex until comment *) let to_comment_re = /[^";# \t\n][^";#\n]*[^";# \t\n]|[^";# \t\n]/ (* Variable: sto_to_comment Store until comment *) let sto_to_comment = Sep.opt_space . store to_comment_re (* Variable: sto_multiline Store multiline values *) let sto_multiline = Sep.opt_space . store (to_comment_re . (/[ \t]*\n/ . Rx.space . to_comment_re)*) (* Variable: sto_multiline_nocomment Store multiline values without an end-of-line comment *) let sto_multiline_nocomment = Sep.opt_space . store (Rx.space_in . (/[ \t]*\n/ . Rx.space . Rx.space_in)*) (* Group: Define comment and defaults *) (* View: comment_noindent Map comments into "#comment" nodes, no indentation allowed Parameters: pat:regexp - pattern to delete before commented data default:string - default pattern before commented data Sample Usage: (start code) let comment = IniFile.comment_noindent "#" "#" let comment = IniFile.comment_noindent IniFile.comment_re IniFile.comment_default (end code) *) let comment_noindent (pat:regexp) (default:string) = Util.comment_generic_seteol (pat . Rx.opt_space) default eol (* View: comment Map comments into "#comment" nodes Parameters: pat:regexp - pattern to delete before commented data default:string - default pattern before commented data Sample Usage: (start code) let comment = IniFile.comment "#" "#" let comment = IniFile.comment IniFile.comment_re IniFile.comment_default (end code) *) let comment (pat:regexp) (default:string) = Util.comment_generic_seteol (Rx.opt_space . pat . Rx.opt_space) default eol (* Variable: comment_re Default regexp for pattern *) let comment_re = /[;#]/ (* Variable: comment_default Default value for pattern *) let comment_default = ";" (* View: empty_generic Empty line, including empty comments Parameters: indent:regexp - the indentation regexp comment_re:regexp - the comment separator regexp *) let empty_generic (indent:regexp) (comment_re:regexp) = Util.empty_generic_dos (indent . comment_re? . Rx.opt_space) (* View: empty Empty line *) let empty = empty_generic Rx.opt_space comment_re (* View: empty_noindent Empty line, without indentation *) let empty_noindent = empty_generic "" comment_re (************************************************************************ * Group: ENTRY *************************************************************************) (* Group: entry includes comments *) (* View: entry_generic_nocomment A very generic INI File entry, not including comments It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment *) let entry_generic_nocomment (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = let bare_re_noquot = (/[^" \t\r\n]/ - comment_re) in let bare_re = (/[^\r\n]/ - comment_re)+ in let no_quot = /[^"\r\n]*/ in let bare = Quote.do_dquote_opt_nil (store (bare_re_noquot . (bare_re* . bare_re_noquot)?)) in let quoted = Quote.do_dquote (store (no_quot . comment_re+ . no_quot)) in [ kw . sep . (Sep.opt_space . bare)? . (comment|eol) ] | [ kw . sep . Sep.opt_space . quoted . (comment|eol) ] (* View: entry_generic A very generic INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment *) let entry_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) = entry_generic_nocomment kw sep comment_re comment | comment (* View: entry Generic INI File entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.entry setting sep comment *) let entry (kw:regexp) (sep:lens) (comment:lens) = entry_generic (key kw) sep comment_re comment (* View: indented_entry Generic INI File entry that might be indented with an arbitrary amount of whitespace Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment Sample Usage: > let entry = IniFile.indented_entry setting sep comment *) let indented_entry (kw:regexp) (sep:lens) (comment:lens) = entry_generic (Util.indent . key kw) sep comment_re comment (* View: entry_multiline_generic A very generic multiline INI File entry It allows to set the key lens (to set indentation or subnodes linked to the key) as well as the comment separator regexp, used to tune the store regexps. Parameters: kw:lens - lens to match the key, including optional indentation sep:lens - lens to use as key/value separator comment_re:regexp - comment separator regexp comment:lens - lens to use as comment eol:lens - lens for end of line Sample Usage: > let entry = IniFile.entry_generic (key "setting") sep IniFile.comment_re comment comment_or_eol *) let entry_multiline_generic (kw:lens) (sep:lens) (comment_re:regexp) (comment:lens) (eol:lens) = let newline = /\r?\n[ \t]+/ in let bare = let word_re_noquot = (/[^" \t\r\n]/ - comment_re)+ in let word_re = (/[^\r\n]/ - comment_re)+ in let base_re = (word_re_noquot . (word_re* . word_re_noquot)?) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote_opt_nil (store sto_re) in let quoted = let no_quot = /[^"\r\n]*/ in let base_re = (no_quot . comment_re+ . no_quot) in let sto_re = base_re . (newline . base_re)* | (newline . base_re)+ in Quote.do_dquote (store sto_re) in [ kw . sep . (Sep.opt_space . bare)? . eol ] | [ kw . sep . Sep.opt_space . quoted . eol ] | comment (* View: entry_multiline Generic multiline INI File entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment *) let entry_multiline (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment (comment|eol) (* View: entry_multiline_nocomment Generic multiline INI File entry without an end-of-line comment Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator comment:lens - lens to use as comment *) let entry_multiline_nocomment (kw:regexp) (sep:lens) (comment:lens) = entry_multiline_generic (key kw) sep comment_re comment eol (* View: entry_list Generic INI File list entry Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator sto:regexp - store regexp for the values list_sep:lens - lens to use as list separator comment:lens - lens to use as comment *) let entry_list (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) (comment:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line_comment kw sep (Sep.opt_space . list) comment (* View: entry_list_nocomment Generic INI File list entry without an end-of-line comment Parameters: kw:regexp - keyword regexp for the label sep:lens - lens to use as key/value separator sto:regexp - store regexp for the values list_sep:lens - lens to use as list separator *) let entry_list_nocomment (kw:regexp) (sep:lens) (sto:regexp) (list_sep:lens) = let list = counter "elem" . Build.opt_list [ seq "elem" . store sto ] list_sep in Build.key_value_line kw sep (Sep.opt_space . list) (* Variable: entry_re Default regexp for keyword *) let entry_re = ( /[A-Za-z][A-Za-z0-9._-]*/ ) (************************************************************************ * Group: RECORD *************************************************************************) (* Group: Title definition *) (* View: title Title for . This maps the title of a record as a node in the abstract tree. Parameters: kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title IniFile.record_re *) let title (kw:regexp) = Util.del_str "[" . key kw . Util.del_str "]". eol (* View: indented_title Title for . This maps the title of a record as a node in the abstract tree. The title may be indented with arbitrary amounts of whitespace Parameters: kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title IniFile.record_re *) let indented_title (kw:regexp) = Util.indent . title kw (* View: title_label Title for . This maps the title of a record as a value in the abstract tree. Parameters: name:string - name for the title label kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title_label "target" IniFile.record_label_re *) let title_label (name:string) (kw:regexp) = label name . Util.del_str "[" . store kw . Util.del_str "]". eol (* View: indented_title_label Title for . This maps the title of a record as a value in the abstract tree. The title may be indented with arbitrary amounts of whitespace Parameters: name:string - name for the title label kw:regexp - keyword regexp for the label Sample Usage: > let title = IniFile.title_label "target" IniFile.record_label_re *) let indented_title_label (name:string) (kw:regexp) = Util.indent . title_label name kw (* Variable: record_re Default regexp for keyword pattern *) let record_re = ( /[^]\r\n\/]+/ - /#comment/ ) (* Variable: record_label_re Default regexp for <title_label> keyword pattern *) let record_label_re = /[^]\r\n]+/ (* Group: Record definition *) (* View: record_noempty INI File Record with no empty lines allowed. Parameters: title:lens - lens to use for title. Use either <title> or <title_label>. entry:lens - lens to use for entries in the record. See <entry>. *) let record_noempty (title:lens) (entry:lens) = [ title . entry* ] (* View: record Generic INI File record Parameters: title:lens - lens to use for title. Use either <title> or <title_label>. entry:lens - lens to use for entries in the record. See <entry>. Sample Usage: > let record = IniFile.record title entry *) let record (title:lens) (entry:lens) = record_noempty title ( entry | empty ) (************************************************************************ * Group: GENERIC LENSES *************************************************************************) (* Group: Lens definition View: lns_noempty Generic INI File lens with no empty lines Parameters: record:lens - record lens to use. See <record_noempty>. comment:lens - comment lens to use. See <comment>. Sample Usage: > let lns = IniFile.lns_noempty record comment *) let lns_noempty (record:lens) (comment:lens) = comment* . record* (* View: lns Generic INI File lens Parameters: record:lens - record lens to use. See <record>. comment:lens - comment lens to use. See <comment>. Sample Usage: > let lns = IniFile.lns record comment *) let lns (record:lens) (comment:lens) = lns_noempty record (comment|empty) (************************************************************************ * Group: READY-TO-USE LENSES *************************************************************************) let record_anon (entry:lens) = [ label "section" . value ".anon" . ( entry | empty )+ ] (* View: lns_loose A loose, ready-to-use lens, featuring: - sections as values (to allow '/' in names) - support empty lines and comments - support for [#;] as comment, defaulting to ";" - .anon sections - don't allow multiline values - allow indented titles - allow indented entries *) let lns_loose = let l_comment = comment comment_re comment_default in let l_sep = sep sep_re sep_default in let l_entry = indented_entry entry_re l_sep l_comment in let l_title = indented_title_label "section" (record_label_re - ".anon") in let l_record = record l_title l_entry in (record_anon l_entry)? . l_record* (* View: lns_loose_multiline A loose, ready-to-use lens, featuring: - sections as values (to allow '/' in names) - support empty lines and comments - support for [#;] as comment, defaulting to ";" - .anon sections - allow multiline values *) let lns_loose_multiline = let l_comment = comment comment_re comment_default in let l_sep = sep sep_re sep_default in let l_entry = entry_multiline entry_re l_sep l_comment in let l_title = title_label "section" (record_label_re - ".anon") in let l_record = record l_title l_entry in (record_anon l_entry)? . l_record*