Skip to content

Commit d0a24f2

Browse files
authored
Apply suggestions from code review
1 parent 38f278b commit d0a24f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

scripts/settings/autogenerate-settings.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ if [ -f "$FUNCTION_SQL_FILE" ]; then
272272
}
273273

274274
# Rename the temporary output file to the correct name
275+
# Category can be "Dates and Times" for example, resulting in `dates and times-functions.md` so we change spaces to underscores
275276
CATEGORY_LOWER=$(echo "$CATEGORY" | tr '[:upper:]' '[:lower:]' | tr ' ' '_')
276277
if [ -f "temp-functions.md" ]; then
277278
echo "${CATEGORY_LOWER}-functions.md"
@@ -400,13 +401,13 @@ for i in "${!insert_src_files[@]}"; do
400401
trap 'rm -f "$tmp_file"' EXIT
401402

402403
# 1. Copy everything up to and including <!--AUTOGENERATED_START-->
403-
sed -n '1,/<!--AUTOGENERATED_START-->/p' "$dest_full_path" > "$tmp_file"
404+
awk '/<!--AUTOGENERATED_START-->/ {print; exit}; {print}' "$dest_full_path" > "$tmp_file"
404405

405406
# 2. Add the content from the source file
406407
cat "$src_rel_path" >> "$tmp_file"
407408

408409
# 3. Add everything from <!--AUTOGENERATED_END--> to the end of the file
409-
sed -n '/<!--AUTOGENERATED_END-->/,$p' "$dest_full_path" >> "$tmp_file"
410+
awk 'BEGIN {found=0}; /<!--AUTOGENERATED_END-->/ {found=1}; found {print}' "$dest_full_path" >> "$tmp_file"
410411

411412
# Replace the original file with the modified content
412413
mv "$tmp_file" "$dest_full_path"

0 commit comments

Comments
 (0)