[augeas-devel] Multiline values in INI Files (Was: Prefix for IniFile entries)

Raphaël Pinson raphink at gmail.com
Fri Aug 29 11:42:05 UTC 2008


On Wed, Aug 27, 2008 at 5:59 PM, Free Ekanayaka <free at 64studio.com> wrote:

> Hi Raphaël,
>
> |--==> On Wed, 27 Aug 2008 12:41:38 +0200, "Raphaël Pinson" <
> raphink at gmail.com> said:
>
>  RP> I think we could add it to inifile.aug. Making it optional is another
> story.
>  RP> Options in augeas lenses are not easy to deal with since you cannot
> have
>  RP> optional arguments to functions nor default values for parameters in
>  RP> functions. That's why inifile.aug ended up with pretty big calls for
> entry,
>  RP> record and lns, and additionnal record_noempty and lns_noempty to deal
> with
>  RP> files that don't accept empty lines. All the same, there would be a
> need for
>  RP> entry_noindent, record_noindent and record_noempty_noindent calls,
> which
>  RP> makes it a bit ugly to my taste. Ideas on this are welcome.
>
> If introducing ugly _noindent declarations is the only viable way at
> the moment, but it makes inifile.aug enough flexible to deal with all
> kind of INI files, then I would go for it. Of course Better
> alternatives are welcome.
>


Just saw another reason for not introducing indent in inifile.aug : some
inifiles use indentation for multi-line values, like



key = this is a long
   text that belongs
   to the same field


This kind of entries are very tricky to deal with (this is why I haven't put
my hands on it yet) because ideally we would like to get

{ "key" = "this is a long\ntext that belongs\nto the same field" }


but all I can think of getting is

{ "key"
   { "1" = "this is a long" }
   { "2" = "text that belongs" }
   { "3" = "to the same field" } }

or

{ "key" = "this is a long\n   text taht belongs\n   to the same field" }


which forces users to indent their value in a not very useful way.
Furthermore, I believe adding a line to such a field should use the same
indentation as the previous lines, which is currently not possible in
augeas.




Raphaël
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080829/f20b9fcf/attachment.htm>


More information about the augeas-devel mailing list