From: Lennart Poettering Date: Wed, 5 Dec 2018 17:38:50 +0000 (+0100) Subject: resolvectl: color "comment" output grey X-Git-Tag: v240~122^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ec4b9671b31f1f429b9176af26a0a57c437e52b6;p=thirdparty%2Fsystemd.git resolvectl: color "comment" output grey Let's de-emphasize the "comment" output a bit, by making it grey. --- diff --git a/src/basic/terminal-util.h b/src/basic/terminal-util.h index 86e730028e4..c885e0a2d1a 100644 --- a/src/basic/terminal-util.h +++ b/src/basic/terminal-util.h @@ -18,6 +18,7 @@ #define ANSI_MAGENTA "\x1B[0;35m" #define ANSI_CYAN "\x1B[0;36m" #define ANSI_WHITE "\x1B[0;37m" +#define ANSI_GREY "\x1B[0;2;37m" /* Bold/highlighted */ #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_magenta, HIGHLIGHT_MAGENTA); DEFINE_ANSI_FUNC(normal, NORMAL); +DEFINE_ANSI_FUNC(grey, GREY); DEFINE_ANSI_FUNC_UNDERLINE(underline, UNDERLINE, NORMAL); DEFINE_ANSI_FUNC_UNDERLINE(highlight_underline, HIGHLIGHT_UNDERLINE, HIGHLIGHT); diff --git a/src/resolve/resolvectl.c b/src/resolve/resolvectl.c index b7544741916..64abc3c46e8 100644 --- a/src/resolve/resolvectl.c +++ b/src/resolve/resolvectl.c @@ -137,7 +137,7 @@ static void print_source(uint64_t flags, usec_t rtt) { if (flags == 0) return; - fputs("\n-- Information acquired via", stdout); + printf("\n%s-- Information acquired via", ansi_grey()); if (flags != 0) 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)); - printf(" in %s", rtt_str); - - fputc('.', stdout); - fputc('\n', stdout); - - printf("-- Data is authenticated: %s\n", yes_no(flags & SD_RESOLVED_AUTHENTICATED)); + printf(" in %s.%s\n" + "%s-- Data is authenticated: %s%s\n", + rtt_str, ansi_normal(), + ansi_grey(), yes_no(flags & SD_RESOLVED_AUTHENTICATED), ansi_normal()); } 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)) log_warning_errno(errno, "Failed to resolve interface name for index %i, ignoring: %m", ifindex); 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 */ - ifname); + ansi_grey(), ifname, ansi_normal()); } static int resolve_host(sd_bus *bus, const char *name) {