mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
wt-status: add helpers for printing wt-status lines
Introduce status_printf{,_ln,_more} wrapper functions around
color_vfprintf() which take care of adding "#" to the beginning of
status lines automatically. The semantics:
- status_printf() is just like color_fprintf() but it adds a "# "
at the beginning of each line of output;
- status_printf_ln() is a convenience function that additionally
adds "\n" at the end;
- status_printf_more() is a variant of status_printf() used to
continue lines that have already started. It suppresses the "#" at
the beginning of the first line.
Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
26db0f2e3a
commit
becbdae82b
9
color.c
9
color.c
@@ -175,6 +175,15 @@ int git_color_default_config(const char *var, const char *value, void *cb)
|
||||
return git_default_config(var, value, cb);
|
||||
}
|
||||
|
||||
void color_print_strbuf(FILE *fp, const char *color, const struct strbuf *sb)
|
||||
{
|
||||
if (*color)
|
||||
fprintf(fp, "%s", color);
|
||||
fprintf(fp, "%s", sb->buf);
|
||||
if (*color)
|
||||
fprintf(fp, "%s", GIT_COLOR_RESET);
|
||||
}
|
||||
|
||||
static int color_vfprintf(FILE *fp, const char *color, const char *fmt,
|
||||
va_list args, const char *trail)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user