21 lines
761 B
Bash
Executable File
21 lines
761 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# Create the README.md file from the docs/src/README_template.md file
|
|
|
|
[[ -d "./docs" ]] || (echo "Folder ./docs not found" && exit 1)
|
|
|
|
README_FILE="./README.md"
|
|
|
|
table_of_content=$(md-table-of-contents ./docs/src/README_template.md) # https://github.com/anotherhadi/md-table-of-contents
|
|
readme_content=$(cat "./docs/src/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"
|