fusionner DEBUG et NULIB_DEBUG
This commit is contained in:
parent
8c37fc15a8
commit
f33bb125bb
@ -242,7 +242,7 @@ function show_error() { return 0; }
|
|||||||
function show_warn() { return 0; }
|
function show_warn() { return 0; }
|
||||||
function show_info() { return 0; }
|
function show_info() { return 0; }
|
||||||
function show_verbose() { return 0; }
|
function show_verbose() { return 0; }
|
||||||
function show_debug() { [ -n "$DEBUG" ]; }
|
function show_debug() { [ -n "$NULIB_DEBUG" ]; }
|
||||||
|
|
||||||
# note: toutes les fonctions d'affichage e* écrivent sur stderr
|
# note: toutes les fonctions d'affichage e* écrivent sur stderr
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ function set_verbosity() {
|
|||||||
-q|--quiet) [ "$__verbosity" -gt 0 ] && let __verbosity=$__verbosity-1;;
|
-q|--quiet) [ "$__verbosity" -gt 0 ] && let __verbosity=$__verbosity-1;;
|
||||||
-v|--verbose) [ "$__verbosity" -lt 5 ] && let __verbosity=$__verbosity+1;;
|
-v|--verbose) [ "$__verbosity" -lt 5 ] && let __verbosity=$__verbosity+1;;
|
||||||
-c|--default) __verbosity=3;;
|
-c|--default) __verbosity=3;;
|
||||||
-D|--debug) __verbosity=5; DEBUG=1;;
|
-D|--debug) __verbosity=5; NULIB_DEBUG=1;;
|
||||||
*) return 1;;
|
*) return 1;;
|
||||||
esac
|
esac
|
||||||
return 0
|
return 0
|
||||||
@ -109,16 +109,16 @@ function set_interaction() {
|
|||||||
# de cette manière:
|
# de cette manière:
|
||||||
# parse_opts ... "${PRETTYOPTS[@]}" @ args -- ...
|
# parse_opts ... "${PRETTYOPTS[@]}" @ args -- ...
|
||||||
PRETTYOPTS=(
|
PRETTYOPTS=(
|
||||||
-L:,--log-to: '$elogto $value_'
|
-L:,--log-to:LOGFILE '$elogto $value_' "++enregistrer les messages dans le fichier spécifié"
|
||||||
-Q,--very-quiet,-q,--quiet,-v,--verbose,-D,--debug '$set_verbosity $option_'
|
-Q,--very-quiet,-q,--quiet,-v,--verbose,-D,--debug '$set_verbosity $option_' "++spécifier le niveau de verbiage"
|
||||||
-b,--batch,-y,--automatic,-i,--interactive '$set_interaction $option_'
|
-b,--batch,-y,--automatic,-i,--interactive '$set_interaction $option_' "++spécifier le niveau d'interaction"
|
||||||
)
|
)
|
||||||
|
|
||||||
function show_error() { [ "$__verbosity" -ge 1 ]; }
|
function show_error() { [ "$__verbosity" -ge 1 ]; }
|
||||||
function show_warn() { [ "$__verbosity" -ge 2 ]; }
|
function show_warn() { [ "$__verbosity" -ge 2 ]; }
|
||||||
function show_info() { [ "$__verbosity" -ge 3 ]; }
|
function show_info() { [ "$__verbosity" -ge 3 ]; }
|
||||||
function show_verbose() { [ "$__verbosity" -ge 4 ]; }
|
function show_verbose() { [ "$__verbosity" -ge 4 ]; }
|
||||||
function show_debug() { [ -n "$DEBUG" -o "$__verbosity" -ge 5 ]; }
|
function show_debug() { [ -n "$NULIB_DEBUG" -o "$__verbosity" -ge 5 ]; }
|
||||||
|
|
||||||
# Vérifier le niveau de verbosité actuel par rapport à l'argument. $1 peut valoir:
|
# Vérifier le niveau de verbosité actuel par rapport à l'argument. $1 peut valoir:
|
||||||
# -Q retourner true si on peut afficher les messages d'erreur
|
# -Q retourner true si on peut afficher les messages d'erreur
|
||||||
@ -132,7 +132,7 @@ function check_verbosity() {
|
|||||||
-q|--quiet) [ "$__verbosity" -ge 2 ];;
|
-q|--quiet) [ "$__verbosity" -ge 2 ];;
|
||||||
-c|--default) [ "$__verbosity" -ge 3 ];;
|
-c|--default) [ "$__verbosity" -ge 3 ];;
|
||||||
-v|--verbose) [ "$__verbosity" -ge 4 ];;
|
-v|--verbose) [ "$__verbosity" -ge 4 ];;
|
||||||
-D|--debug) [ -n "$DEBUG" -o "$__verbosity" -ge 5 ];;
|
-D|--debug) [ -n "$NULIB_DEBUG" -o "$__verbosity" -ge 5 ];;
|
||||||
*) return 0;;
|
*) return 0;;
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user