From a22294e811ffc7b5765aa0b7190b438588222e1b Mon Sep 17 00:00:00 2001 From: Dieter Plaetinck Date: Sat, 28 Feb 2009 16:29:49 +0100 Subject: error checking on $TYPE in ask_option --- src/core/libs/lib-ui.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/libs') diff --git a/src/core/libs/lib-ui.sh b/src/core/libs/lib-ui.sh index b7f24f9..336a3e7 100644 --- a/src/core/libs/lib-ui.sh +++ b/src/core/libs/lib-ui.sh @@ -355,6 +355,7 @@ _dia_ask_option () [ -z "$2" ] && die_error "ask_option \$2 must be the title" # $3 is optional more info TYPE=${4:-required} + [ "$TYPE" != required -a "$TYPE" != optional ] && debug 'UI' "_dia_ask_option args: $@" && die_error "ask option \$4 must be required or optional or ''. not $TYPE" [ -z "$6" ] && debug 'UI' "_dia_ask_option args: $@" && die_error "ask_option makes only sense if you specify at least one option (with tag and name)" #nothing wrong with only 1 option. it still shows useful info to the user DIA_MENU_TITLE=$2 @@ -523,6 +524,7 @@ _cli_ask_option () [ -z "$2" ] && die_error "ask_option \$2 must be the title" # $3 is optional more info TYPE=${4:-required} + [ "$TYPE" != required -a "$TYPE" != optional ] && debug 'UI' "_dia_ask_option args: $@" && die_error "ask option \$4 must be required or optional or ''. not $TYPE" [ -z "$6" ] && debug 'UI' "_dia_ask_option args: $@" && die_error "ask_option makes only sense if you specify at least one option (with tag and name)" #nothing wrong with only 1 option. it still shows useful info to the user MENU_TITLE=$2 -- cgit v1.2.3-54-g00ecf