Gentoo Archives: gentoo-dev

From: Joe Peterson <lavajoe@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Default blank lines for error, elog, einfo, etc
Date: Sat, 07 Jun 2008 00:07:29
Message-Id: 4849D13A.1070002@gentoo.org
In Reply to: Re: [gentoo-dev] Re: Default blank lines for error, elog, einfo, etc by "William L. Thomson Jr."
1 William L. Thomson Jr. wrote:
2 > On Sat, 2008-06-07 at 00:42 +0200, Vlastimil Babka wrote:
3 >> There could be also switch to add newline
4 >> before the message but I can't think of a use for it myself.
5 >> The question is how to name the switch :) "-n" could be confusing as
6 >> "echo -n" has the opposite effect. Maybe "-b" for "blank"?
7 >
8 > Or -p for preceding -t for trailing. Which would make one liner
9 >
10 > elog -pt "One line with blank ones before and after"
11
12 The comment from Vlastimil about echo not being part of the elog system
13 is a very valid point indeed. As for how to specify that a newline
14 should be inserted, I think that using elog switches like "-n", "-p",
15 etc., as well as putting more than one string on a line present two
16 problems: the newline would be "connected" with the "elog" or "ewarn"
17 (or whatever style of output was chosen) and it would also potentially
18 make the ebuild code harder to read/debug. For example, if you have a
19 block of "ewarn" lines, then a blank line, then a block of "elog" lines,
20 you would have to decide in which style to place the special switch (so
21 portage would not have the opportunity to do auto-context
22 coloring/formatting).
23
24 I personally would prefer a new command like "eseparator" that could be
25 treated "smartly" by portage, taking on the appropriate color based on
26 what is before and after. It could also avoid multiple newlines in the
27 case in which two eseparator lines occur together due to pattern of
28 conditional blocks in the ebuild invoked under certain circumstances (I
29 have found this hard to code in a way that covers all possibilities, as
30 I mentioned before). Also, separators at the very beginning or very end
31 of all lines output by the ebuild could be handled consistently (either
32 ignored or collapsed into an implicit separator, as appropriate) by
33 portage to produce nice output.
34
35 -Joe
36 --
37 gentoo-dev@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Re: Default blank lines for error, elog, einfo, etc Vlastimil Babka <caster@g.o>