diff options
author | Jouke Witteveen <j.witteveen@gmail.com> | 2013-10-23 01:20:54 +0200 |
---|---|---|
committer | Jouke Witteveen <j.witteveen@gmail.com> | 2013-10-24 00:40:02 +0200 |
commit | 2f1ef4d9f87af7112c6bbb7c53bbe7bafe3ef8b1 (patch) | |
tree | e139d9ece4f512dbb20ca770b2d1c26bfa9769b1 /src/lib | |
parent | 7c4329462e411c110b8dded92cc4b0d935e1e95d (diff) | |
download | netctl-2f1ef4d9f87af7112c6bbb7c53bbe7bafe3ef8b1.tar.gz netctl-2f1ef4d9f87af7112c6bbb7c53bbe7bafe3ef8b1.tar.xz |
beautify error output
Also: tag error messages as systemd error messages when the messages are
not directed to the terminal.
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/globals | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/lib/globals b/src/lib/globals index a2a281f..f31beac 100644 --- a/src/lib/globals +++ b/src/lib/globals @@ -15,7 +15,12 @@ report_notice() { } report_error() { - echo "$*" + local prefix="<3>" suffix="" + if [[ -t 2 ]]; then + prefix=$(tput bold; tput setaf 1) + suffix=$(tput sgr0) + fi + echo "$prefix$*$suffix" >&2 } report_debug() { @@ -23,7 +28,7 @@ report_debug() { } exit_error() { - report_error "$@" >&2 + report_error "$@" exit 1 } |