Cleanup main loop

This commit is contained in:
2024-08-04 21:17:27 -04:00
parent 67099f1328
commit 6a03b3fc7a

View File

@@ -533,11 +533,12 @@ interactive_header() {
echo
cat <<-EOF
Enter project number(s) to analyze:
* A comma-separated list of project numbers (ex. 2,5,12)
* <Enter> for the latest project ($num) (default)
* A comma-separated list of project numbers (2,5,12)
* 0 to add a new project
* <Enter> for the latest project ($num)
EOF
((YES)) || read -r -p "($num): " response
echo ""
if [[ $response == 0 ]]; then
ask_pn && PROJECTS+=("${ADD_PROJECTS[@]}")
else
@@ -568,12 +569,12 @@ interactive_header() {
if [[ ${#MODULES[@]} -eq 0 && ${#EXCLUDE_MODULES[@]} -eq 0 ]]; then
cat <<-EOF
Enter modules(s) to run:
* A comma-separated list of module numbers
* Example: 2,5,12
* <Enter> for all (default)
* A comma-separated list of module numbers (2,5,12)
* 0 for none
* <Enter> for all modules (default)
EOF
((YES)) || read -r -p "(all): " response
echo ""
if [[ -z $response ]]; then
MODULES=("${ALL_MODULES[@]}")
elif [[ $response -eq 0 ]]; then
@@ -591,13 +592,14 @@ interactive_header() {
while :; do
cat <<-EOF
Enter submodules(s) to run followed by its arguments in a comma-separated string
* Quote your string if there are any whitespaces
* <Enter> for none (default)
* A comma-separated list of submodules and their arguments
* Both arguments are required
* Quote the argument string if it contains whitespace
* Example: ${ALL_SUBMODULES[0]},\"arg1,arg2,arg3...\",${ALL_SUBMODULES[1]},\"arg1,arg2,arg3...\"
* <Enter> for none (default)
EOF
((YES)) || read -r -p "(none): " response
echo ""
[[ -z $response ]] && break
IFS=',' read -ra arr <<< "$response"
if [[ $((${#arr[@]} % 2)) -eq 0 ]]; then # check if array is even
@@ -1262,10 +1264,17 @@ qhtcp() {
if [[ -d $QHTCP_PROJECT_DIR ]]; then
# Handle existing output directory
echo "A project already exists at $QHTCP_PROJECT_DIR"
echo "Would you like to (c)ontinue, (u)pdate it from the template and continue, or (b)ack it up and continue from scratch?"
cat <<-EOF
A project already exists at $QHTCP_PROJECT_DIR
Would you like to
* (c)ontinue (default)
* (u)pdate it from the template and continue
* (b)ack it up and start from scratch
EOF
for i in {1..3}; do # give the user three chances to get it right
((YES)) || read -r -p "Hit [Enter] or c to continue: " response
((YES)) || read -r -p "(c): " response
echo ""
[[ -z $response ]] && break
case $response in
u)