Some header work

This commit is contained in:
2024-08-01 16:48:03 -04:00
parent 4a62f1e522
commit 7acbd90f62

View File

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