diff --git a/workflow/qhtcp-workflow b/workflow/qhtcp-workflow index 61480542..e741362f 100755 --- a/workflow/qhtcp-workflow +++ b/workflow/qhtcp-workflow @@ -299,6 +299,8 @@ print_header() { EOF + echo "Arguments: $*" + echo "" echo "Using scans directory: $SCANS_DIR" echo "Change the SCANS_DIR environment variable to override" echo "Example: SCANS_DIR=/path/to/scans ./qhtcp-workflow" @@ -312,31 +314,44 @@ print_header() { projects=("$SCANS_DIR"/*/) shopt -u nullglob - projects=("${projects[@]%/}") # strip comma first! - projects=("${projects[@]##*/}") - - - echo "Available Projects:" - for i in "${!projects[@]}"; do - printf "%d. %s\n" "$((i+1))" "${projects[i]}" - done - echo "" echo "Available Modules:" for i in "${!ALL_MODULES[@]}"; do printf "%d. %s\n" "$((i+1))" "${ALL_MODULES[i]}" done echo "" + echo "Available Submodules:" for i in "${!ALL_SUBMODULES[@]}"; do printf "%d. %s\n" "$((i+1))" "${ALL_SUBMODULES[i]}" done + echo "" - last_index=$(( ${#ALL_MODULES} - 1 )) + echo "Available Projects:" + projects=("${projects[@]%/}") # strip comma first! + projects=("${projects[@]##*/}") + for i in "${!projects[@]}"; do + printf "%d. %s\n" "$((i+1))" "${projects[i]}" + done + echo "" + + if [[ -z $PROJECT ]]; then + last=${#projects[@]} + echo "Enter project number(s) to run (comma deliminated)" + ((YES)) || read -r -p "Hit enter to select default ($((last + 1))): " response1 + [[ -z $response1 ]] && response1=$last + IFS=',' read -ra arr <<< "$response1" + declare -gxa PROJECTS + for i in "${arr[@]}"; do + PROJECTS+=("${projects[$((i-1))]}") + done + fi + + # last_index=$(( ${#ALL_MODULES} - 1 )) read -r -p "Enter a comma deliminated list of modules to run: " response1 IFS=',' read -ra MODULES <<< "$response1" - last_index=$(( ${#ALL_SUBMODULES} - 1 )) - read -r -p "Enter the item number to select EASY results directory, default ($last_index): " response2 + # last_index=$(( ${#ALL_SUBMODULES} - 1 )) + read -r -p "Enter a comma deliminated list of submodules to run: " response2 IFS=',' read -ra SUBMODULES <<< "$response2" # cat <<-EOF @@ -1592,10 +1607,10 @@ main() { declare -a PROJECTS=() # this array will hold all of the projects for this run - print_header - parse_input "$@" # parse arguments with getopt + print_header "$@" + # Prompt user for the PROJECT if we still don't have one if [[ ${#PROJECTS[@]} -eq 0 ]]; then ask_pn && PROJECTS+=("$PROJECT")