Add color output to zfs diff.

This adds support to color zfs diff (in the style of git diff)
conditional on the ZFS_COLOR environment variable.

Signed-off-by: Ethan Coe-Renner <coerenner1@llnl.gov>
This commit is contained in:
Ethan Coe-Renner
2022-12-12 15:30:51 -08:00
committed by Tony Hutter
parent 24502bd3a7
commit fb11b1570a
4 changed files with 53 additions and 2 deletions
+7 -2
View File
@@ -2010,15 +2010,20 @@ use_color(void)
void
color_start(const char *color)
{
if (use_color())
if (use_color()) {
fputs(color, stdout);
fflush(stdout);
}
}
void
color_end(void)
{
if (use_color())
if (use_color()) {
fputs(ANSI_RESET, stdout);
fflush(stdout);
}
}
/* printf() with a color. If color is NULL, then do a normal printf. */