diff options
author | Colin Walters <walters@verbum.org> | 2013-09-18 16:34:14 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2013-09-18 16:34:14 -0400 |
commit | 4c1a69f74e85c9e377e943f3b8dcdae4cd992b54 (patch) | |
tree | d6d88c66d9688d3e7357e9d36282c94eb9d916f9 /src/ostree/main.c | |
parent | 58a8d6d6efca9cd7469ac4623bd0d8d69052e11e (diff) | |
download | ostree-4c1a69f74e85c9e377e943f3b8dcdae4cd992b54.tar.gz |
main: Print error: in red bold just for fun
It's easier to see. Also drop old dead ot_main() function.
Diffstat (limited to 'src/ostree/main.c')
-rw-r--r-- | src/ostree/main.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/ostree/main.c b/src/ostree/main.c index f23e8260..3e164f9e 100644 --- a/src/ostree/main.c +++ b/src/ostree/main.c @@ -26,6 +26,7 @@ #include <errno.h> #include <string.h> +#include <unistd.h> #include <locale.h> #include "ot-main.h" @@ -75,7 +76,15 @@ main (int argc, if (error != NULL) { - g_message ("%s", error->message); + int is_tty = isatty (1); + const char *prefix = ""; + const char *suffix = ""; + if (is_tty) + { + prefix = "\x1b[31m\x1b[1m"; /* red, bold */ + suffix = "\x1b[22m\x1b[0m"; /* bold off, color reset */ + } + g_printerr ("%serror: %s%s\n", prefix, suffix, error->message); g_error_free (error); } |