#!/usr/bin/env bash # Create the README.md file from the .github/assets/README_template.md file [[ -d "./docs" ]] || (echo "Folder ./docs not found" && exit 1) README_FILE="./README.md" table_of_content=$(markdown-table-of-contents --start-by 2 ./.github/assets/README_template.md) # https://github.com/anotherhadi/markdown-table-of-contents readme_content=$(cat "./.github/assets/README_template.md") # Replace variables readme_content=${readme_content//\{primarycolor\}/A594FD} readme_content=${readme_content//\{backgroundcolor\}/0b0b0b} readme_content=${readme_content//\{md_table_of_content\}/$table_of_content} echo "[//]: # (This file is autogenerated)" >"$README_FILE" echo "$readme_content" >>"$README_FILE" sed 's/\r//' "$README_FILE" >"/tmp/readme.md" mv "/tmp/readme.md" "$README_FILE"