resolvectl: color "comment" output grey

Let's de-emphasize the "comment" output a bit, by making it grey.
This commit is contained in:
Lennart Poettering 2018-12-05 18:38:50 +01:00
parent 38585af313
commit ec4b9671b3
2 changed files with 9 additions and 9 deletions

View File

@ -18,6 +18,7 @@
#define ANSI_MAGENTA "\x1B[0;35m" #define ANSI_MAGENTA "\x1B[0;35m"
#define ANSI_CYAN "\x1B[0;36m" #define ANSI_CYAN "\x1B[0;36m"
#define ANSI_WHITE "\x1B[0;37m" #define ANSI_WHITE "\x1B[0;37m"
#define ANSI_GREY "\x1B[0;2;37m"
/* Bold/highlighted */ /* Bold/highlighted */
#define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m" #define ANSI_HIGHLIGHT_BLACK "\x1B[0;1;30m"
@ -132,6 +133,7 @@ DEFINE_ANSI_FUNC(highlight_yellow, HIGHLIGHT_YELLOW);
DEFINE_ANSI_FUNC(highlight_blue, HIGHLIGHT_BLUE); DEFINE_ANSI_FUNC(highlight_blue, HIGHLIGHT_BLUE);
DEFINE_ANSI_FUNC(highlight_magenta, HIGHLIGHT_MAGENTA); DEFINE_ANSI_FUNC(highlight_magenta, HIGHLIGHT_MAGENTA);
DEFINE_ANSI_FUNC(normal, NORMAL); DEFINE_ANSI_FUNC(normal, NORMAL);
DEFINE_ANSI_FUNC(grey, GREY);
DEFINE_ANSI_FUNC_UNDERLINE(underline, UNDERLINE, NORMAL); DEFINE_ANSI_FUNC_UNDERLINE(underline, UNDERLINE, NORMAL);
DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline, HIGHLIGHT_UNDERLINE, HIGHLIGHT); DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline, HIGHLIGHT_UNDERLINE, HIGHLIGHT);

View File

@ -137,7 +137,7 @@ static void print_source(uint64_t flags, usec_t rtt) {
if (flags == 0) if (flags == 0)
return; return;
fputs("\n-- Information acquired via", stdout); printf("\n%s-- Information acquired via", ansi_grey());
if (flags != 0) if (flags != 0)
printf(" protocol%s%s%s%s%s", printf(" protocol%s%s%s%s%s",
@ -149,12 +149,10 @@ static void print_source(uint64_t flags, usec_t rtt) {
assert_se(format_timespan(rtt_str, sizeof(rtt_str), rtt, 100)); assert_se(format_timespan(rtt_str, sizeof(rtt_str), rtt, 100));
printf(" in %s", rtt_str); printf(" in %s.%s\n"
"%s-- Data is authenticated: %s%s\n",
fputc('.', stdout); rtt_str, ansi_normal(),
fputc('\n', stdout); ansi_grey(), yes_no(flags & SD_RESOLVED_AUTHENTICATED), ansi_normal());
printf("-- Data is authenticated: %s\n", yes_no(flags & SD_RESOLVED_AUTHENTICATED));
} }
static void print_ifindex_comment(int printed_so_far, int ifindex) { static void print_ifindex_comment(int printed_so_far, int ifindex) {
@ -166,9 +164,9 @@ static void print_ifindex_comment(int printed_so_far, int ifindex) {
if (!if_indextoname(ifindex, ifname)) if (!if_indextoname(ifindex, ifname))
log_warning_errno(errno, "Failed to resolve interface name for index %i, ignoring: %m", ifindex); log_warning_errno(errno, "Failed to resolve interface name for index %i, ignoring: %m", ifindex);
else else
printf("%*s-- link: %s", printf("%*s%s-- link: %s%s",
60 > printed_so_far ? 60 - printed_so_far : 0, " ", /* Align comment to the 60th column */ 60 > printed_so_far ? 60 - printed_so_far : 0, " ", /* Align comment to the 60th column */
ifname); ansi_grey(), ifname, ansi_normal());
} }
static int resolve_host(sd_bus *bus, const char *name) { static int resolve_host(sd_bus *bus, const char *name) {