Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- May 28, 2018, 18:40 UTC
- Message-ID
- <CACsJy8CZQLxU5TPx=M0NV_xTR_9qyjbOWnVcdX9-Tz+BCb24VA@mail.gmail.com>
- In-Reply-To
- <90ac0a41563f070a840076521d8935ad7c21beb9.1527279322.git.martin.agren@gmail.com>
On Fri, May 25, 2018 at 11:00 PM, Martin Ågren <martin.agren@gmail.com> wrote:
Show 19 quoted lines
> advice.c contains a useful code snippet which takes a multi-line string > and prints the lines, prefixing and suffixing each line with two > constant strings. This was originally added in 23cb5bf3b3 (i18n of > multi-line advice messages, 2011-12-22) to produce such output: > > hint: some multi-line advice > hint: prefixed with "hint: " > > The prefix is actually colored after 960786e761 (push: colorize errors, > 2018-04-21) and each line has a suffix for resetting the color. > > The next commit will teach the same "prefix all the lines"-trick to the > code that produces, e.g., "warning: "-messages. In preparation for that, > extract the code for printing the individual lines and expose it through > git-compat-util.h. > > Signed-off-by: Martin Ågren <martin.agren@gmail.com> > --- > I'm open for suggestions on the naming of `prefix_suffix_lines()`...
I think the important verb, print (to FILE*), is somehow missing. This current name would be great if it produces another str(buf).
-- Duy