améliorer ergnonomie. en particulier, ne pas afficher la valeur par défaut d'un mot de passe

This commit is contained in:
Jephte CLAIN 2014-12-07 09:01:35 +04:00
parent afb9327fc5
commit 7cf63355fd
1 changed files with 15 additions and 8 deletions

View File

@ -3123,15 +3123,15 @@ function read_value() {
# est vide, afficher un message d'erreur et retourner faux
# read_password() est comme read_value(), mais la valeur saisie n'est pas
# affichée, ce qui la rend appropriée pour la lecture d'un mot de passe.
local -a __rv_opts
local -a __rv_opts __rv_readline=1 __rv_showdef=1 __rv_nl=
__rv_opts=()
[ -n "$UTOOLS_NO_READLINE" ] && __rv_readline=
__rv_read "$@"
}
function read_password() {
local -a __rv_opts
local -a __rv_opts __rv_readline= __rv_showdef= __rv_nl=1
__rv_opts=(-s)
__rv_read "$@"
echo ""
}
function __rv_read() {
local __rv_int=1
@ -3162,13 +3162,20 @@ function __rv_read() {
else
tooenc_ "Entrez la valeur" "$UTF8" 1>&2
fi
if [ -n "$UTOOLS_NO_READLINE" ]; then
[ -n "$__rv_d" ] && tooenc_ " [$__rv_d]" 1>&2
tooenc_ ": " "$UTF8" 1>&2
uread "${__rv_opts[@]}" __rv_r
else
if [ -n "$__rv_readline" ]; then
tooenc_ ": " "$UTF8" 1>&2
uread -e ${__rv_d:+-i"$__rv_d"} "${__rv_opts[@]}" __rv_r
else
if [ -n "$__rv_d" ]; then
if [ -n "$__rv_showdef" ]; then
tooenc_ " [$__rv_d]" 1>&2
else
tooenc_ " [****]" 1>&2
fi
fi
tooenc_ ": " "$UTF8" 1>&2
uread "${__rv_opts[@]}" __rv_r
[ -n "$__rv_nl" ] && echo
fi
__rv_r="${__rv_r:-$__rv_d}"
if [ -n "$__rv_r" ] || ! is_yes "$__rv_re"; then