Gentoo Archives: gentoo-dev

From: Mike Frysinger <vapier@g.o>
To: gentoo-dev@l.g.o
Subject: Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable=
Date: Tue, 29 Jan 2013 02:28:02
Message-Id: 201301282128.12147.vapier@gentoo.org
In Reply to: Re: readme.gentoo.eclass: use echo -e instead of plain echo (Was: Re: [gentoo-dev] readme.gentoo.eclass: Add a DISABLE_AUTOFORMATTING variable= by Pacho Ramos
1 On Monday 28 January 2013 14:30:06 Pacho Ramos wrote:
2 > El lun, 28-01-2013 a las 14:37 +0800, Ben de Groot escribió:
3 > > On 28 January 2013 12:37, Mike Frysinger wrote:
4 > > > On Sunday 27 January 2013 13:21:27 Pacho Ramos wrote:
5 > > >> The problem is that it doesn't work so well. If I have the following
6 > > >> at src_prepare (for example):
7 > > >> src_prepare() {
8 > > >>
9 > > >> DOC_CONTENTS="You must create a symlink rom
10 > > >> /etc/splash/tuxonice
11 > > >> to the theme you want tuxonice to use, e.g.: \n
12 > > >> # ln -sfn /etc/splash/emergence
13 > > >> /etc/splash/tuxonice \n"
14 > > >> ...
15 > > >>
16 > > >> and I handle ${DOC_CONTENTS} with quotes, it will end writing that
17 > > >> tabs also in generated file as the contents of the variable will be
18 > > >> put as-is. On the other hand, if I don't put it between quotes
19 > > >
20 > > > forcibly normalizing whitespace for all callers is wrong imo (as is
21 > > > sending it through `fmt`). if the caller gave you content to write,
22 > > > it should write it. if the caller didn't want tabs, it shouldn't have
23 > > > used it in the first place.
24 > >
25 > > I've started using this eclass, but with README files, not the variable,
26 > > because this is currently the only way I can make sure it honours my
27 > > formatting.
28 >
29 > Couldn't it be covered if "echo -e" was used (even with fmt) and you,
30 > then, control formatting with some of the sequences it allows (they are
31 > shown in its man page)?
32
33 how is it better to require people to fill the string with \x20\n\t than to
34 respect what was given ? if people want to normalize whitespace themselves,
35 they could just as easily do the `echo` themselves.
36 -mike

Attachments

File name MIME type
signature.asc application/pgp-signature