diff options
author | Nikias Bassen | 2020-05-28 23:11:24 +0200 |
---|---|---|
committer | Nikias Bassen | 2020-05-28 23:11:24 +0200 |
commit | 45ba75a9a48f61b65e4487fa706dc764a85198b9 (patch) | |
tree | ff382b3c197ae36b9d5d4bf5c24497aabef430e7 | |
parent | 4331c3c06bc3b99c271996523866ae5184a87521 (diff) | |
download | libimobiledevice-45ba75a9a48f61b65e4487fa706dc764a85198b9.tar.gz libimobiledevice-45ba75a9a48f61b65e4487fa706dc764a85198b9.tar.bz2 |
idevicesyslog: Add command line switch --no-colors to disable colored output
-rw-r--r-- | docs/idevicesyslog.1 | 3 | ||||
-rw-r--r-- | tools/idevicesyslog.c | 8 |
2 files changed, 10 insertions, 1 deletions
diff --git a/docs/idevicesyslog.1 b/docs/idevicesyslog.1 index fce1ff5..b7bc04f 100644 --- a/docs/idevicesyslog.1 +++ b/docs/idevicesyslog.1 @@ -25,6 +25,9 @@ enable communication debugging .TP .B \-h, \-\-help prints usage information +.TP +.B \-\-no\-colors +disable colored output .SH FILTER OPTIONS .TP diff --git a/tools/idevicesyslog.c b/tools/idevicesyslog.c index 5d5a639..bd692cd 100644 --- a/tools/idevicesyslog.c +++ b/tools/idevicesyslog.c @@ -526,6 +526,7 @@ static void print_usage(int argc, char **argv, int is_error) " -x, --exit exit when device disconnects\n" \ " -h, --help prints usage information\n" \ " -d, --debug enable communication debugging\n" \ + " --no-colors disable colored output\n" \ "\n" \ "FILTER OPTIONS:\n" \ " -m, --match STRING only print messages that contain STRING\n" \ @@ -553,6 +554,7 @@ int main(int argc, char *argv[]) COLOR_RESET = csbi.wAttributes; } #endif + int no_colors = 0; int include_filter = 0; int exclude_filter = 0; int include_kernel = 0; @@ -573,6 +575,7 @@ int main(int argc, char *argv[]) { "kernel", no_argument, NULL, 'k' }, { "no-kernel", no_argument, NULL, 'K' }, { "quiet-list", no_argument, NULL, 1 }, + { "no-colors", no_argument, NULL, 2 }, { NULL, 0, NULL, 0} }; @@ -682,6 +685,9 @@ int main(int argc, char *argv[]) printf("%s\n", QUIET_FILTER); return 0; } + case 2: + no_colors = 1; + break; default: print_usage(argc, argv, 1); return 2; @@ -733,7 +739,7 @@ int main(int argc, char *argv[]) argc -= optind; argv += optind; - if (isatty(1)) { + if (!no_colors && isatty(1)) { use_colors = 1; } |