diff --git a/scripts/settings/autogenerate-settings.sh b/scripts/settings/autogenerate-settings.sh index 45da9e4340d..24392ab302f 100755 --- a/scripts/settings/autogenerate-settings.sh +++ b/scripts/settings/autogenerate-settings.sh @@ -259,6 +259,7 @@ if [ -f "$FUNCTION_SQL_FILE" ]; then "Comparison" "Conditional" "Distance" + "Dates and Times" ) for CATEGORY in "${FUNCTION_CATEGORIES[@]}"; do @@ -271,15 +272,17 @@ if [ -f "$FUNCTION_SQL_FILE" ]; then } # Rename the temporary output file to the correct name - CATEGORY_LOWER=$(echo "$CATEGORY" | tr '[:upper:]' '[:lower:]') + # Category can be "Dates and Times" for example, resulting in `dates and times-functions.md` so we change spaces to underscores + CATEGORY_LOWER=$(echo "$CATEGORY" | tr '[:upper:]' '[:lower:]' | tr ' ' '_') if [ -f "temp-functions.md" ]; then + echo "${CATEGORY_LOWER}-functions.md" mv "temp-functions.md" "${CATEGORY_LOWER}-functions.md" || { echo "[$SCRIPT_NAME] Error: Failed to rename temp-functions.md to ${CATEGORY_LOWER}-functions.md" exit 1 } echo "[$SCRIPT_NAME] Generated ${CATEGORY_LOWER}-functions.md" else - echo "[$SCRIPT_NAME] Warning: temp-functions.md not found after processing $CATEGORY functions" + echo "[$SCRIPT_NAME] Warning: temp-functions.md not found for $CATEGORY" fi done else @@ -360,7 +363,9 @@ insert_src_files=( "comparison-functions.md" "conditional-functions.md" "distance-functions.md" + "dates_and_times-functions.md" ) + insert_dest_files=( "docs/about-us/beta-and-experimental-features.md" "docs/sql-reference/functions/arithmetic-functions.md" @@ -370,8 +375,10 @@ insert_dest_files=( "docs/sql-reference/functions/comparison-functions.md" "docs/sql-reference/functions/conditional-functions.md" "docs/sql-reference/functions/distance-functions.md" + "docs/sql-reference/functions/date-time-functions.md" ) -echo "[$SCRIPT_NAME] Inserting generated markdown content between tags" + +echo "[$SCRIPT_NAME] Inserting generated markdown content between AUTOGENERATED_START and AUTOGENERATED_END tags" for i in "${!insert_src_files[@]}"; do src_file="${insert_src_files[i]}" @@ -405,7 +412,7 @@ for i in "${!insert_src_files[@]}"; do # Replace the original file with the modified content mv "$tmp_file" "$dest_full_path" else - echo "[$SCRIPT_NAME] Error: Expected to find and tags in $dest_full_path, but did not" + echo "[$SCRIPT_NAME] Error: Expected to find AUTOGENERATED_START and AUTOGENERATED_END tags in $dest_full_path, but did not" exit 1 fi @@ -424,7 +431,7 @@ cd "$parent_of_tmp" || echo "[$SCRIPT_NAME] Warning: Failed to cd back to parent echo "[$SCRIPT_NAME] Removing contents of temporary directory: $tmp_dir" # Use full path for removal just in case cd failed rm -rf "$tmp_dir"/* -rmdir "$tmp_dir" 2>/dev/null || echo "[$SCRIPT_NAME] Info: Did not remove $tmp_dir (might contain hidden files or already gone)." +rmdir "$tmp_dir" 2>/dev/null || echo "[$SCRIPT_NAME] Unable to remove $tmp_dir" echo "[$SCRIPT_NAME] Auto-generation of settings markdown pages completed successfully." exit 0