Updates for newer program versions

This commit is contained in:
Autumn Naber
2026-08-12 12:28:33 -07:00
parent 86beb728e8
commit 27bb8ff4ee
10 changed files with 75 additions and 47 deletions
+26
View File
@@ -0,0 +1,26 @@
#!/bin/bash
BASE_PATH="/home/anaber/prj/trenton"
DB_NAME="compile_commands.json"
function do_update {
DB_SRC="$1"
ln -sf "${DB_SRC}" "${BASE_PATH}"/"${DB_NAME}"
}
# Get a list of valid compile command databases in the repo
mapfile -t DB_LIST < <( find "${BASE_PATH}" -mindepth 2 -type f -name "${DB_NAME}" )
idx=0
for DB_ELEM in ${DB_LIST[@]}; do
echo "${idx}: ${DB_ELEM}"
idx=$((idx+1))
done
# Parse and validate the user selection
read -p "Select an option to update: " SELECTION
NUM_ELEM=${#DB_LIST[@]}
MAX_ELEM=$((NUM_ELEM-1))
case "${SELECTION}" in
''|*[!0-${MAX_ELEM}]*) echo "Operation cancelled" ;;
*) do_update "${DB_LIST[${SELECTION}]}" ;;
esac