systemctl: ensure underline for "list-unit-files" empty cells

This commit is contained in:
Lennart Poettering 2020-05-06 14:56:37 +02:00
parent 50098d87fb
commit 45d82c3f1c
2 changed files with 5 additions and 2 deletions

View file

@ -28,6 +28,7 @@
#define ANSI_HIGHLIGHT_YELLOW4 "\x1B[0;1;38;5;100m"
/* Underlined */
#define ANSI_GREY_UNDERLINE "\x1B[0;4;38;5;245m"
#define ANSI_HIGHLIGHT_RED_UNDERLINE "\x1B[0;1;4;31m"
#define ANSI_HIGHLIGHT_GREEN_UNDERLINE "\x1B[0;1;4;32m"
#define ANSI_HIGHLIGHT_YELLOW_UNDERLINE "\x1B[0;1;4;38;5;185m"
@ -138,6 +139,7 @@ DEFINE_ANSI_FUNC(highlight_grey, HIGHLIGHT_GREY);
DEFINE_ANSI_FUNC_UNDERLINE(underline, UNDERLINE, NORMAL);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline, HIGHLIGHT_UNDERLINE, HIGHLIGHT);
DEFINE_ANSI_FUNC_UNDERLINE(grey_underline, GREY_UNDERLINE, GREY);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_red_underline, HIGHLIGHT_RED_UNDERLINE, HIGHLIGHT_RED);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_green_underline, HIGHLIGHT_GREEN_UNDERLINE, HIGHLIGHT_GREEN);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_yellow_underline, HIGHLIGHT_YELLOW_UNDERLINE, HIGHLIGHT_YELLOW);

View file

@ -1546,8 +1546,9 @@ static int output_unit_file_list(const UnitFileList *units, unsigned c) {
TABLE_STRING, unit_preset_str,
TABLE_SET_COLOR, strempty(on_preset_color));
} else
r = table_add_many(table, TABLE_EMPTY);
r = table_add_many(table,
TABLE_EMPTY,
TABLE_SET_COLOR, underline ? ansi_grey_underline() : ansi_grey());
if (r < 0)
return table_log_add_error(r);
}