regex changes for ignore

This commit is contained in:
Heavybullets8 2022-07-28 16:48:27 -06:00
parent 8e654d5942
commit 1fa9e3f908
2 changed files with 5 additions and 9 deletions

View File

@ -142,7 +142,7 @@ case $selection in
;; ;;
2 | -i) 2 | -i)
read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore read -rt 600 -p "What is the name of the application we should ignore?: " up_ignore
! [[ $up_ignore =~ ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue ! [[ $up_ignore =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]] && echo -e "Error: \"$up_ignore\" is invalid, that is not the name youre using for your application" && sleep 5 && continue
update_selection+=("-i" "$up_ignore") update_selection+=("-i" "$up_ignore")
;; ;;
3 | -r) 3 | -r)

View File

@ -71,15 +71,11 @@ do
rollback="true" rollback="true"
;; ;;
i) i)
# Check next positional parameter if ! [[ $OPTARG =~ ^[a-zA-Z]([-a-zA-Z0-9]*[a-zA-Z0-9])?$ ]]; then # Using case insensitive version of the regex used by Truenas Scale
eval nextopt=${!OPTIND} echo -e "Error: \"$OPTARG\" is invalid, that is not the name youre using for your application"
# existing or starting with dash?
if [[ -n $nextopt && $nextopt != -* ]] ; then
OPTIND=$((OPTIND + 1))
ignore+=("$nextopt")
else
echo "Option: \"-i\" requires an argument"
exit exit
else
ignore+=("$OPTARG")
fi fi
;; ;;
t) t)