Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-31 Thread Jeff King
On Wed, May 30, 2018 at 12:26:40PM +0200, Martin Ågren wrote: > >>> So perhaps: > >>> > >>> void report_lines(FILE *out, > >>> const char *color, const char *color_reset, > >>> const char *prefix, const char *msg); > >>> > >>> or something? > >> > >> Sounds

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-30 Thread Martin Ågren
On 30 May 2018 at 08:00, Junio C Hamano wrote: > Junio C Hamano writes: > >> Jeff King writes: >> >>> But most importantly, it means we could eventually colorize errors, too, >>> where we are not allowed to allocate. >>> >>> So perhaps: >>> >>> void report_lines(FILE *out, >>>

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-30 Thread Junio C Hamano
Junio C Hamano writes: > Jeff King writes: > >> But most importantly, it means we could eventually colorize errors, too, >> where we are not allowed to allocate. >> >> So perhaps: >> >> void report_lines(FILE *out, >> const char *color, const char *color_reset, >>

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-29 Thread Junio C Hamano
Jeff King writes: > But most importantly, it means we could eventually colorize errors, too, > where we are not allowed to allocate. > > So perhaps: > > void report_lines(FILE *out, > const char *color, const char *color_reset, > const char *prefix, const

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-29 Thread Jeff King
On Fri, May 25, 2018 at 11:00:53PM +0200, Martin Ågren wrote: > +/* > + * Write the message to the file, prefixing and suffixing > + * each line with `prefix` resp. `suffix`. > + */ > +void prefix_suffix_lines(FILE *f, const char *prefix, > + const char *message, const char

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-29 Thread Jeff King
On Mon, May 28, 2018 at 08:40:16PM +0200, Duy Nguyen wrote: > On Fri, May 25, 2018 at 11:00 PM, Martin Ågren wrote: > > 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

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-28 Thread Duy Nguyen
On Fri, May 25, 2018 at 11:00 PM, Martin Ågren wrote: > 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,

Re: [RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-28 Thread Junio C Hamano
Martin Ågren writes: > I'm open for suggestions on the naming of `prefix_suffix_lines()`... Is there a verb that means "have/place the thing in between two other things" or "Bring two things and place them on each side of the third thing" in a more concise way? Wrap?

[RFC PATCH 1/3] usage: extract `prefix_suffix_lines()` from `advise()`

2018-05-25 Thread Martin Ågren
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