Skip to content
Snippets Groups Projects
Commit 67b5000f authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

handle empty selection in showSelectAndInput

parent 7b9c90c4
No related branches found
No related tags found
1 merge request!129Db Profiles
......@@ -262,12 +262,18 @@
local _lines
typeset -i _lines; _lines=$( grep -c "." <<< "$_selection" )
if [ $_lines -eq "1" ]; then
case $_lines in
0)
color.echo error "ERROR no data for a further selection. Aborting."
echo
exit 1
;;
1)
echo "INFO: No interaction on a single choice. Using '$_selection'"
LASTINPUT="$_selection"
return 0
else
;;
*)
echo "$_selection"
color.print input "${_prompt} >"
read -r LASTINPUT
......@@ -275,7 +281,8 @@
echo "No input given. Aborting."
exit 1
fi
fi
;;
esac
}
# ------------------------------------------------------------
......@@ -358,7 +365,7 @@ EOH
while [[ "$#" -gt 0 ]]; do case $1 in
-h|--help) showhelp; exit 0;;
*) if grep "^-" <<< "$1" >/dev/null ; then
echo; echo "ERROR: Unknown parameter: $1"; echo; showhelp; exit 2
echo; color.echo error "ERROR: Unknown parameter: $1"; echo; showhelp; exit 2
fi
break;
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment