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

Raphaël Pinson raphink at gmail.com
Tue Nov 2 23:22:25 UTC 2010


Committed as bfbfcf1d9fb6ad64257f7b95ba55a698ff91f93e

On Mon, Nov 1, 2010 at 6:08 PM, Raphael Pinson <raphink at gmail.com> wrote:

> ---
>  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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20101103/bef95061/attachment.htm>


More information about the augeas-devel mailing list