PF_cFlags="--description --help --version" AllTimeFolders= __getAllTime(){ # Initialize empty array for time folders local time_folders=() # Loop through all directories in current folder for dir in */; do # Remove trailing slash dir=${dir%/} # Check if directory name is a valid floating point number # This pattern matches integers and floating point numbers if [[ $dir =~ ^[0-9]+(\.[0-9]+)?$ ]]; then time_folders+=("$dir") fi done # Set completion reply to the time folders COMPREPLY=("${time_folders[@]}") AllTimeFolders="${time_folders[@]}" } __getFields(){ __getAllTime local -A unique_files=() # Files to exclude from suggestions local exclude_files=("shapeHash" "pStructure" "particleInsertion" "p" "alpha" "U" "Sp" "Su" "phi") declare -A exclude_dict # Build exclude dictionary for faster lookups for file in "${exclude_files[@]}"; do exclude_dict["$file"]=1 done for dir in $AllTimeFolders; do # Skip if not a directory [ ! -d "$dir" ] && continue # Find all files in this time directory while IFS= read -r filename; do # Skip empty lines and excluded files [ -z "$filename" ] || [ "${exclude_dict[$filename]+exists}" ] && continue # Add to unique files unique_files["$filename"]=1 done < <(find "$dir" -maxdepth 1 -type f -printf '%f\n') done # Set completion reply to the unique filenames COMPREPLY=(${!unique_files[@]}) # Clear global variable AllTimeFolders= } _pFlowToVTK(){ local cur="${COMP_WORDS[COMP_CWORD]}" local prev="${COMP_WORDS[COMP_CWORD-1]}" # Check if we're completing a field local is_field=0 for ((i=1; i