Merge pull request #30101 from poettering/underline-rework

systemctl: "list-units" table tweaks
This commit is contained in:
Lennart Poettering
2023-12-06 22:13:12 +01:00
committed by GitHub
4 changed files with 181 additions and 45 deletions
+11
View File
@@ -59,6 +59,8 @@
/* Other ANSI codes */
#define ANSI_UNDERLINE "\x1B[0;4m"
#define ANSI_ADD_UNDERLINE "\x1B[4m"
#define ANSI_ADD_UNDERLINE_GREY ANSI_ADD_UNDERLINE "\x1B[58;5;245m"
#define ANSI_HIGHLIGHT "\x1B[0;1;39m"
#define ANSI_HIGHLIGHT_UNDERLINE "\x1B[0;1;4m"
@@ -189,6 +191,15 @@ static inline const char *ansi_underline(void) {
return underline_enabled() ? ANSI_UNDERLINE : ANSI_NORMAL;
}
static inline const char *ansi_add_underline(void) {
return underline_enabled() ? ANSI_ADD_UNDERLINE : "";
}
static inline const char *ansi_add_underline_grey(void) {
return underline_enabled() ?
(colors_enabled() ? ANSI_ADD_UNDERLINE_GREY : ANSI_ADD_UNDERLINE) : "";
}
#define DEFINE_ANSI_FUNC_UNDERLINE(name, NAME) \
static inline const char *ansi_##name(void) { \
return underline_enabled() ? ANSI_##NAME##_UNDERLINE : \