Skip to content

Commit

Permalink
fix: sed
Browse files Browse the repository at this point in the history
  • Loading branch information
aeimer committed Oct 25, 2023
1 parent 22f6a7d commit bef46e3
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions .ci-scripts/update-toc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ function generateToc() {
programNameList=()

while read -r file; do
# shellcheck disable=SC2001
programName=$(cut -d@ -f1 <<<"$file")
programNameList+=("$programName")
done < <(find "Formula" -maxdepth 1 -type f -name '*.rb' -exec basename {} \; | sort)
Expand All @@ -20,4 +19,4 @@ echo "Generating TOC in README.md"
toc=$(generateToc)
echo "$toc"
# https://stackoverflow.com/questions/2699666/replace-delimited-block-of-text-in-file-with-the-contents-of-another-file
sed -i -ne '/<!-- BEGIN TOC -->/ {p; r '<<<"$toc" -e ':a; n; /<!-- END TOC -->/ {p; b}; ba}; p' README.md
sed -i -ne '/<!-- BEGIN TOC -->/ {p; r '<(cat <<<"$toc") -e ':a; n; /<!-- END TOC -->/ {p; b}; ba}; p' README.md

0 comments on commit bef46e3

Please sign in to comment.