Cleanup prompts

This commit is contained in:
2024-08-04 20:45:15 -04:00
parent e4a12719c0
commit cf58bbdcf2

View File

@@ -535,7 +535,7 @@ interactive_header() {
Enter project number(s) to analyze: Enter project number(s) to analyze:
* A comma-separated list of project numbers (ex. 2,5,12) * A comma-separated list of project numbers (ex. 2,5,12)
* 0 to add a new project * 0 to add a new project
* Enter to accept the default (newest) project ($num) * <Enter> for the latest project ($num)
EOF EOF
((YES)) || read -r -p "($num): " response ((YES)) || read -r -p "($num): " response
if [[ $response == 0 ]]; then if [[ $response == 0 ]]; then
@@ -566,8 +566,14 @@ interactive_header() {
done done
if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 ]]; then if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 ]]; then
echo "Enter a comma-separated list of modules to run" cat <<-EOF
((YES)) || read -r -p "Hit Enter for all (default) or '0' for none: " response Enter modules(s) to run:
* A comma-separated list of module numbers
* Example: 2,5,12
* 0 for none
* <Enter> for all modules (default)
EOF
((YES)) || read -r -p "(all): " response
if [[ -z $response ]]; then if [[ -z $response ]]; then
MODULES=("${ALL_MODULES[@]}") MODULES=("${ALL_MODULES[@]}")
elif [[ $response -eq 0 ]]; then elif [[ $response -eq 0 ]]; then
@@ -583,16 +589,21 @@ interactive_header() {
if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 && ${#SUBMODULES[@]} -eq 0 ]]; 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" cat <<-EOF
echo "Quote your string if there are any whitespaces" Enter submodules(s) to run followed by its arguments in a comma-separated string
echo "Example: ${ALL_SUBMODULES[0]} \"arg1,arg2,arg3...\"" * Quote your string if there are any whitespaces
((YES)) || read -r -p "Or hit Enter to continue: " response * A comma-separated list of submodules and their arguments
* Both arguments are required
* Example: ${ALL_SUBMODULES[0]},\"arg1,arg2,arg3...\",${ALL_SUBMODULES[1]},\"arg1,arg2,arg3...\"
* <Enter> for none (default)
EOF
((YES)) || read -r -p "(none): " response
[[ -z $response ]] && break [[ -z $response ]] && break
IFS=' ' read -ra arr <<< "$response" IFS=',' read -ra arr <<< "$response"
if [[ ! ${#arr[@]} -eq 2 ]]; then if [[ $((${#arr[@]} % 2)) -eq 0 ]]; then # check if array is even
err "The second argument is required and may be an empty string, \"\""
else
SUBMODULES+=("${arr[@]}") SUBMODULES+=("${arr[@]}")
else
err "The second argument is required (may be an empty string, \"\")"
fi fi
unset response arr i unset response arr i
done done