diff options
author | Dieter Plaetinck <dieter@plaetinck.be> | 2009-02-28 16:29:49 +0100 |
---|---|---|
committer | Dieter Plaetinck <dieter@plaetinck.be> | 2009-02-28 16:29:49 +0100 |
commit | a22294e811ffc7b5765aa0b7190b438588222e1b (patch) | |
tree | fa97429dfe9d80ddccde1de4f41fb5bbf5b2a690 /src | |
parent | 4d7dbff90b8333deb2c2c3c0dbd1aa3e9aafa3d5 (diff) |
error checking on $TYPE in ask_option
Diffstat (limited to 'src')
-rw-r--r-- | src/core/libs/lib-ui.sh | 2 |
1 files changed, 2 insertions, 0 deletions
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 |