[augeas-devel] [PATCH] Allow flags

Raphaël Pinson raphink at gmail.com
Wed Aug 13 20:38:50 UTC 2008


On Wed, Aug 13, 2008 at 8:29 PM, David Lutterkort <dlutter at redhat.com>wrote:

> On Wed, 2008-08-13 at 18:20 +0200, Raphael Pinson wrote:
> > # HG changeset patch
> > # User Raphael Pinson <raphink at gmail.com>
> > # Date 1218644422 -7200
> > # Node ID 0fecb892aefdeef53e5c73d7cfe2c862e1e79488
> > # Parent  77868db94cb316e09e7872cc3ab087a22ec9684c
> > Allow flags
> >
> > diff -r 77868db94cb3 -r 0fecb892aefd lenses/inifile.aug
> > --- a/lenses/inifile.aug      Wed Aug 13 14:16:45 2008 +0200
> > +++ b/lenses/inifile.aug      Wed Aug 13 18:20:22 2008 +0200
> > @@ -41,7 +41,7 @@ let empty                = Util.empty
> >
> >  (* Some implementations of INI file allow ":" as separator *)
> >  let entry_generic (kw:regexp) (sep:lens) (comment:lens)
> > -                    = [ key kw . sep . value_to_comment? . (comment|eol)
> ]
> > +                    = [ key kw . (sep . value_to_comment?)? .
> (comment|eol) ]
> >  let entry (kw:regexp)
> >                      = entry_generic kw value_sepwithcolon comment
> >  let entry_setcomment (kw:regexp) (comment:lens)
>
> I have two issues with this patch:


I can understand. I was not happy with it either and tried to find other
ways before coming to this. I needed this patch for mysql.cnf, which is an
INI File with flags, the only one I know so far, although I don't believe it
is in the RFC.


    1. it's now legal to drop the '=' in _any_ inifile - is there a way
>        to do this only for the files where a key all by itself is
>        legal ?


I could declare the entry in mysql.cnf instead. Originally, I declared a
flag entry in mysql.cnf and then called 'let record = IniFile.record
(entry|flag)' but the typechecker complained that entry and flag could
override (i.e. on put augeas wouldn't know if a field was a flag or an
entry). I'd be happy to fix it within mysql.cnf though. For now, not
applying this patch breaks mysql.aug only.


Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080813/cab19d01/attachment.htm>


More information about the augeas-devel mailing list