[augeas-devel] [PATCH] Add comments in the tree, using Util.comment and Util.empty.
Raphael Pinson
raphink at gmail.com
Wed Apr 8 13:43:21 UTC 2009
---
lenses/shellvars.aug | 5 +++--
lenses/tests/test_shellvars.aug | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 841669e..d3e4bbe 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -7,7 +7,8 @@ module Shellvars =
let key_re = /[A-Za-z0-9_]+(\[[0-9]+\])?/ - "unset" - "export"
let eq = Util.del_str "="
- let comment = [ del /(#.*)?[ \t]*\n/ "# \n" ]
+ let comment = Util.comment
+ let empty = Util.empty
let char = /[^() '"\t\n]|\\\\"/
let dquot = /"([^"\\\n]|\\\\.)*"/ (* " Emacs, relax *)
@@ -40,7 +41,7 @@ module Shellvars =
Util.del_ws_spc . store /[^= \t\n]+/ . eol
]
- let lns = (comment | source | kv | unset) *
+ let lns = (comment | empty | source | kv | unset) *
let sc_incl (n:string) = (incl ("/etc/sysconfig/" . n))
let filter_sysconfig =
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index b27f160..552d20c 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -17,14 +17,14 @@ unset ONBOOT
let key_brack = "SOME_KEY[1]=\nDEVICE=eth0\n"
test Shellvars.lns get eth_static =
- { }
+ { "#comment" = "Intel Corporation PRO/100 VE Network Connection" }
{ "DEVICE" = "eth0" }
{ "BOOTPROTO" = "static" }
{ "BROADCAST" = "172.31.0.255" }
{ "HWADDR" = "ab:cd:ef:12:34:56" }
{ "IPADDR" = "172.31.0.31"
{ "export" } }
- { }
+ { "#comment" = "DHCP_HOSTNAME=host.example.com" }
{ "NETMASK" = "255.255.255.0" }
{ "NETWORK" = "172.31.0.0" }
{ "unset" = "ONBOOT" }
--
1.5.6.3
More information about the augeas-devel
mailing list