[Nix-dev] Newlines in nix strings - good look

Lluís Batlle i Rossell viriketo at gmail.com
Sun May 9 20:10:19 CEST 2010


On Sun, May 09, 2010 at 07:56:52PM +0200, Marc Weber wrote:
> Excerpts from Lluís Batlle i Rossell's message of Sun May 09 19:36:12 +0200 2010:
> > Hello,
> > 
> > often I hit the problem of wanting a string in a newline in some case, else
> > no string. Something like:
> > ''
> >   blabla
> > 
> >   ${if x then "xxx" else "yyy"}
> > 
> >   ${if z then "zzz" else "yyy"}
> > 
> >   blublu
> > ''
> > 
> > I don't like the result having two void lines. A nice example of what I don't
> > want you can find at the upstart jobs. :)
> > Have you thought of a comfortable nix source that looks simple both in source
> > and result?
> > 
> > Thank you,
> > Lluís.
> 
> primop.removeDuplicateLinse ''
>   [..]
> ''
I think you did not understand as I wanted. The source I wrote may end up with
three, four or five void lines. What if I wanted these kind of results?
''
  blabla

  blublu
''

or

''
  blabla

  yyy

  blublu
''
...

I can only think of bad-looking nix code to achieve that.

It is not that I care a lot about the layout of text in result files, but if
there is a way I could write better (both source and results), why not adopt it? :)



More information about the nix-dev mailing list