[augeas-devel] [PATCH] Add shells.aug and associated test

Raphael Pinson raphink at gmail.com
Mon Nov 1 17:08:14 UTC 2010


---
 lenses/shells.aug            |   37 +++++++++++++++++++++++++++++++++++++
 lenses/tests/test_shells.aug |   15 +++++++++++++++
 2 files changed, 52 insertions(+), 0 deletions(-)
 create mode 100644 lenses/shells.aug
 create mode 100644 lenses/tests/test_shells.aug

diff --git a/lenses/shells.aug b/lenses/shells.aug
new file mode 100644
index 0000000..07c96fa
--- /dev/null
+++ b/lenses/shells.aug
@@ -0,0 +1,37 @@
+(*
+Module: Shells
+  Parses /etc/shells
+
+Author: Raphael Pinson <raphink at gmail.com>
+
+About: Reference
+  This lens tries to keep as close as possible to `man 5 shells` where possible.
+
+About: License
+   This file is licenced under the LGPLv2+, like the rest of Augeas.
+
+About: Lens Usage
+   To be documented
+
+About: Configuration files
+   This lens applies to /etc/shells. See <filter>.
+*)
+
+
+module Shells =
+  autoload xfm
+
+let empty = Util.empty
+let comment = Util.comment
+let shell = [ seq "shell" . store /[^# \t\n]+/ . Util.eol ]
+
+(* View: lns
+     The shells lens
+*)
+let lns = ( empty | comment | shell )*
+
+(* Variable: filter *)
+let filter = incl "/etc/shells"
+    . Util.stdexcl
+
+let xfm = transform lns filter
diff --git a/lenses/tests/test_shells.aug b/lenses/tests/test_shells.aug
new file mode 100644
index 0000000..5dceca3
--- /dev/null
+++ b/lenses/tests/test_shells.aug
@@ -0,0 +1,15 @@
+(* Test for shells lens *)
+
+module Test_shells =
+
+   let conf = "# this is a comment
+
+/bin/bash
+/bin/tcsh
+"
+
+   test Shells.lns get conf =
+      { "#comment" = "this is a comment" }
+      {}
+      { "1" = "/bin/bash" }
+      { "2" = "/bin/tcsh" }
-- 
1.7.0.4




More information about the augeas-devel mailing list