Commit c8951fab authored by Emeric Verschuur's avatar Emeric Verschuur
Browse files

warn/err function update

parent 09198545
Pipeline #59 passed with stage
in 36 seconds
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
set -e set -e
function bashopts_exit_handle() { bashopts_exit_handle() {
local err=$? local err=$?
set +o xtrace set +o xtrace
local code="${1:-1}" local code="${1:-1}"
...@@ -46,30 +46,18 @@ set -o errtrace ...@@ -46,30 +46,18 @@ set -o errtrace
# display a error (fatal) # display a error (fatal)
bashopts_critical() { bashopts_critical() {
local l >&2 printf "[ERROR] %s\n" "$@"
>&2 echo -n "[ERROR] "
for l in "$@"; do
>&2 echo -e "$l"
done
exit 1 exit 1
} }
# display a error (non fatal) # display a error (non fatal)
bashopts_error() { bashopts_error() {
local l >&2 printf "[ERROR] %s\n" "$@"
>&2 echo -n "[ERROR] "
for l in "$@"; do
>&2 echo -e "$l"
done
} }
# display a warning (non fatal) # display a warning (non fatal)
bashopts_warning() { bashopts_warning() {
local l >&2 printf "[WARNING] %s\n" "$@"
>&2 echo -n "[WARNING] "
for l in "$@"; do
>&2 echo -e "$l"
done
} }
bashopts_regex_escape () { bashopts_regex_escape () {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment