Loop header ask on bad project nums
This commit is contained in:
@@ -263,7 +263,7 @@ ask_pn() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
[[ -z ${ADD_PROJECTS[*]} ]]
|
[[ ${#ADD_PROJECTS[@]} -gt 0 ]]
|
||||||
}
|
}
|
||||||
debug() { (( DEBUG )) && echo "Debug: $*"; }
|
debug() { (( DEBUG )) && echo "Debug: $*"; }
|
||||||
# Not super portable but nice to have
|
# Not super portable but nice to have
|
||||||
@@ -525,22 +525,29 @@ interactive_header() {
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Let user choose or add project(s)
|
# Let user choose or add project(s)
|
||||||
if [[ -z ${PROJECTS[*]} ]]; then
|
if [[ ${#PROJECTS[@]} -eq 0 ]]; then
|
||||||
num=$((${#projects[@]}))
|
num=$((${#projects[@]}))
|
||||||
if [[ $num -eq 0 ]]; then
|
if [[ $num -eq 0 ]]; then
|
||||||
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
||||||
else
|
else
|
||||||
echo "Enter a comma-separated list of project numbers to analyze"
|
for ((c=0; c<=1; c++)); do # safe loop that only runs once
|
||||||
((YES)) || read -r -p "Enter \"new\" to add a new project or hit Enter for default ($num): " response
|
echo "Enter a comma-separated list of project numbers to analyze"
|
||||||
if [[ $response == "new" ]]; then
|
((YES)) || read -r -p "Enter 0 to add a new project or hit Enter for default project ($num): " response
|
||||||
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
if [[ $response == 0 ]]; then
|
||||||
else
|
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
|
||||||
[[ -z $response ]] && response=$num
|
else
|
||||||
IFS=',' read -ra arr <<< "$response"
|
[[ -z $response ]] && response=$num
|
||||||
for i in "${arr[@]}"; do
|
IFS=',' read -ra arr <<< "$response"
|
||||||
PROJECTS+=("${projects[$((i-1))]}")
|
for i in "${arr[@]}"; do
|
||||||
done
|
if [[ -n ${projects[$((i-1))]} ]]; then
|
||||||
fi
|
PROJECTS+=("${projects[$((i-1))]}")
|
||||||
|
else
|
||||||
|
err "Project number $i is invalid"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
[[ ${#PROJECTS[@]} -eq 0 ]] && c=0 # repeat the loop
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
unset response arr i
|
unset response arr i
|
||||||
fi
|
fi
|
||||||
@@ -553,7 +560,7 @@ interactive_header() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ -z ${MODULES[*]} && -z ${EXCLUDE_MODULES[*]} ]]; then
|
if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 ]]; then
|
||||||
echo "Enter a comma-separated list of modules to run"
|
echo "Enter a comma-separated list of modules to run"
|
||||||
((YES)) || read -r -p "Hit Enter for all (default) or '0' for none: " response
|
((YES)) || read -r -p "Hit Enter for all (default) or '0' for none: " response
|
||||||
if [[ -z $response ]]; then
|
if [[ -z $response ]]; then
|
||||||
@@ -569,7 +576,7 @@ interactive_header() {
|
|||||||
unset response arr i
|
unset response arr i
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z ${MODULES[*]} && -z ${EXCLUDE_MODULES[*]} && -z ${SUBMODULES[*]} ]]; then
|
if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 && ${#SUBMODULES[@]} -eq 0 ]]; then
|
||||||
while :; do
|
while :; do
|
||||||
echo "Enter a submodule followed by its arguments as a comma-separated string"
|
echo "Enter a submodule followed by its arguments as a comma-separated string"
|
||||||
echo "Quote your string if there are any whitespaces"
|
echo "Quote your string if there are any whitespaces"
|
||||||
|
|||||||
Reference in New Issue
Block a user