diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-05 22:29:02 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2008-12-05 22:29:02 +0100 |
commit | dbeb438b0c9f1abda89d009cbe17129f4f3413af (patch) | |
tree | 43b8c526a3ddea43ab842821c37616e41a3d5f21 | |
parent | 98580fe64c10317a61a9232066e2300ebf6179d6 (diff) |
regression fix n shit
-rw-r--r-- | src/core/libs/lib-ui.sh | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index 72052c0..6f31887 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -260,6 +260,7 @@ _dia_ask_number () return $? } + _dia_ask_option () { DEFAULT="" @@ -388,16 +389,41 @@ _cli_ask_option () _cli_ask_password () { + if [ -n "$1" ] + then + type_l=`tr '[:upper:]' '[:lower:]' <<< $1` + type_u=`tr '[:lower:]' '[:upper:]' <<< $1` + else + type_l= + type_u= + fi + + echo -n "Enter your $type_l password: " + stty -echo + [ -n "$type_u" ] && read ${type_u}_PASSWORD + [ -z "$type_u" ] && read PASSWORD + stty echo + echo } -_cli_ask_string () #TODO: implement default answer +_cli_ask_string () { - echo -n "$@: " + echo "$1: " + [ -n "$2" ] && echo "(Press enter for default. Default: $2)" + echo -n ">" read ANSWER_STRING echo "$ANSWER_STRING" debug "cli_ask_string: User entered: $ANSWER_STRING" - [ -z "$ANSWER_STRING" ] && return 1 + if [ -z "$ANSWER_STRING" ] + then + if [ -n "$2" ] + then + ANSWER_STRING=$2 + else + return 1 + fi + fi return 0 } |