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

warn/err function update

parent 09198545
Loading
Loading
Loading
Loading
Loading
+4 −16
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@

set -e

function bashopts_exit_handle() {
bashopts_exit_handle() {
  local err=$?
  set +o xtrace
  local code="${1:-1}"
@@ -46,30 +46,18 @@ set -o errtrace

# display a error (fatal)
bashopts_critical() {
    local l
    >&2 echo -n "[ERROR] "
    for l in "$@"; do
        >&2 echo -e "$l"
    done
    >&2 printf "[ERROR] %s\n" "$@"
    exit 1
}

# display a error (non fatal)
bashopts_error() {
    local l
    >&2 echo -n "[ERROR] "
    for l in "$@"; do
        >&2 echo -e "$l"
    done
    >&2 printf "[ERROR] %s\n" "$@"
}

# display a warning (non fatal)
bashopts_warning() {
    local l
    >&2 echo -n "[WARNING] "
    for l in "$@"; do
        >&2 echo -e "$l"
    done
    >&2 printf "[WARNING] %s\n" "$@"
}

bashopts_regex_escape () {