27 lines
841 B
Bash
Executable File
27 lines
841 B
Bash
Executable File
#!/bin/bash
|
|
|
|
HEADER_FILE="readme-header.md"
|
|
README_FILE="README.md"
|
|
|
|
# Create or truncate the README file
|
|
> $README_FILE
|
|
|
|
# Add the header to the README file
|
|
cat $HEADER_FILE >> $README_FILE
|
|
|
|
# Loop through each directory in the current working directory
|
|
for dir in */; do
|
|
# Extract and print the directory name without the trailing slash
|
|
echo -e "\n## ${dir%/}\n" >> $README_FILE
|
|
|
|
# Loop through all PNG files in the directory and embed them in the README file
|
|
for png in "$dir"*.png; do
|
|
[ -f "$png" ] || break # Break if no more PNG files are found
|
|
echo "" >> $README_FILE
|
|
done
|
|
|
|
# Print a list of .scad files in the directory
|
|
echo -e "\nModel files:\n" >> $README_FILE
|
|
find "$dir" -type f -name '*.scad' | sed "s|$dir||g" | awk '{ print "* " $0 }' >> $README_FILE
|
|
done
|