modifs.mineures sans commentaires

This commit is contained in:
Jephté Clain 2023-11-02 21:42:34 +04:00
parent 1d53f41ef4
commit 861d39974f
1 changed files with 17 additions and 10 deletions

View File

@ -265,36 +265,37 @@ function eerror() {
show_error || return; eflush; __eerror "$*" 1>&2
}
function set_die_return() {
NULIB_DIE="return 1"
}
function die() {
[ $# -gt 0 ] && eerror "$@"
exit 1
}
function exit_with {
if [ $# -gt 0 ]; then "$@"; fi
exit $?
local die="${NULIB_DIE:-exit 1}"
eval "$die" || return
}
function die_with {
[ $# -gt 0 ] && eerror "$1"
shift
[ $# -gt 0 ] && "$@"
exit 1
local die="${NULIB_DIE:-exit 1}"
eval "$die" || return
}
function die_unless() {
# Afficher $1 et quitter le script avec die() si la commande $2..@ retourne FAUX
local du__r
local du__msg="$1"; shift
local du__die="${NULIB_DIE:-exit 1}"
if [ $# -eq 0 ]; then
[ -n "$du__msg" ] && _eerror "$du__msg"
exit 1
eval "$du__die" || return
elif "$@"; then
:
else
du__r=$?
[ -n "$du__msg" ] && _eerror "$du__msg"
exit $du__r
eval "${du__die% 1} $du__r" || return
fi
return 0
}
@ -320,10 +321,11 @@ function die_if() {
# Afficher $1 et quitter le script avec die() si la commande $2..@ retourne VRAI. sinon, retourner le code de retour de la commande
local di__r=0
local di__msg="$1"; shift
local di__die="${NULIB_DIE:-exit 1}"
[ $# -eq 0 ] && return 0
if "$@"; then
[ -n "$di__msg" ] && _eerror "$di__msg"
exit 0
eval "${di__die% 1} 0" || return
else
di__r=$?
fi
@ -343,6 +345,11 @@ function eerror_if() {
return $ei__r
}
function exit_with {
if [ $# -gt 0 ]; then "$@"; fi
exit $?
}
function ewarn() {
# Afficher un message d'avertissement
show_warn || return; eflush; __ewarn "$*" 1>&2