From 50fb3f5f6d6cd73be342ff9ccbc880b725fe4cb8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?David=20Va=C5=A1ek?= Date: Tue, 17 Aug 2021 22:40:07 +0200 Subject: [PATCH] keymgr: colorize output to terminals only --- doc/man/keymgr.8in | 2 +- doc/man_keymgr.rst | 2 +- src/utils/keymgr/main.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/man/keymgr.8in b/doc/man/keymgr.8in index 48739f5f1c..98d8a9423f 100644 --- a/doc/man/keymgr.8in +++ b/doc/man/keymgr.8in @@ -60,7 +60,7 @@ TSIG key is only displayed on \fIstdout\fP: the command does not create a file, key in a keystore. .TP \fB\-b\fP, \fB\-\-brief\fP -List keys briefly. +List keys briefly. Output to a terminal is colorized. .TP \fB\-l\fP, \fB\-\-list\fP Print the list of zones that have at least one key stored in the configured KASP diff --git a/doc/man_keymgr.rst b/doc/man_keymgr.rst index b6554df431..5edba45280 100644 --- a/doc/man_keymgr.rst +++ b/doc/man_keymgr.rst @@ -37,7 +37,7 @@ Basic options key in a keystore. **-b**, **--brief** - List keys briefly. + List keys briefly. Output to a terminal is colorized. **-l**, **--list** Print the list of zones that have at least one key stored in the configured KASP diff --git a/src/utils/keymgr/main.c b/src/utils/keymgr/main.c index 0da4397eb1..b1629323ac 100644 --- a/src/utils/keymgr/main.c +++ b/src/utils/keymgr/main.c @@ -423,7 +423,7 @@ int main(int argc, char *argv[]) break; case 'b': list_params.brief = true; - list_params.color = true; // TODO: disable if not stdout + list_params.color = isatty(STDOUT_FILENO); break; default: print_help(); -- 2.47.3