diff --git a/README.md b/README.md index 9b5e036..e700714 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ The models come with ![buffer-stops-v2.png](brio-tracks/buffer-stops-v2.png) +Documentation: + +* [README.md](brio-tracks/README.md) + Model files: * ascending_n_v1.scad @@ -37,6 +41,14 @@ Model files: * cube-with-square-hole.scad +## cup-letter-wrap + +![cup-letter-wrap-a.png](cup-letter-wrap/cup-letter-wrap-a.png) + +Model files: + +* cup-letter-wrap.scad + ## cutlery-organizer ![cutlery-organizer-180x80x25.png](cutlery-organizer/cutlery-organizer-180x80x25.png) @@ -47,13 +59,6 @@ Model files: * cutlery-organizer.scad -## door-stopper-cheese - - -Model files: - -* door-stopper-cheese.scad - ## duct-coupler ![duct-coupler.png](duct-coupler/duct-coupler.png) @@ -95,6 +100,15 @@ Model files: * fluke-lead-holder-hsw.scad +## hex-nespresso-insert + +![hex-nespresso-insert.png](hex-nespresso-insert/hex-nespresso-insert.png) + +Model files: + +* hex-nespresso-insert-variant.scad +* hex-nespresso-insert.scad + ## home-assistant-voice-wall-mount ![home-assistant-voice-wall-mount.png](home-assistant-voice-wall-mount/home-assistant-voice-wall-mount.png) @@ -105,8 +119,8 @@ Model files: ## korg-piano-volume-knob -![korg-piano-volume-knob-bottom.png](korg-piano-volume-knob/korg-piano-volume-knob-bottom.png) ![korg-piano-volume-knob.png](korg-piano-volume-knob/korg-piano-volume-knob.png) +![korg-piano-volume-knob-bottom.png](korg-piano-volume-knob/korg-piano-volume-knob-bottom.png) Model files: @@ -192,8 +206,8 @@ Model files: ## slim-rpi-wall-holder -![slim-rpi-wall-holder.png](slim-rpi-wall-holder/slim-rpi-wall-holder.png) ![slim-rpi-wall-holder-zero.png](slim-rpi-wall-holder/slim-rpi-wall-holder-zero.png) +![slim-rpi-wall-holder.png](slim-rpi-wall-holder/slim-rpi-wall-holder.png) Model files: @@ -207,13 +221,6 @@ Model files: * spice-rack-organizer.scad -## spiral-cable-wrap - - -Model files: - -* spiral-cable-wrap.scad - ## thirdreality-zigbee-sensor-mount ![thirdreality-zigbee-sensor-mount.png](thirdreality-zigbee-sensor-mount/thirdreality-zigbee-sensor-mount.png) @@ -225,20 +232,13 @@ Model files: ## toy-cubes ![cylinder_with_round_hole.png](toy-cubes/cylinder_with_round_hole.png) -![octagon_simple.png](toy-cubes/octagon_simple.png) ![pentagon_with_round_hole.png](toy-cubes/pentagon_with_round_hole.png) +![octagon_simple.png](toy-cubes/octagon_simple.png) Model files: * toy-cubes.scad -## toy-pylon - - -Model files: - -* toy-pylon.scad - ## tree-stand-floor-protector ![tree-stand-floor-protector.png](tree-stand-floor-protector/tree-stand-floor-protector.png) diff --git a/generate-readme.sh b/generate-readme.sh index 679527b..2ae9c17 100755 --- a/generate-readme.sh +++ b/generate-readme.sh @@ -4,23 +4,46 @@ HEADER_FILE="readme-header.md" README_FILE="README.md" # Create or truncate the README file -> $README_FILE +> "$README_FILE" # Add the header to the README file -cat $HEADER_FILE >> $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 +# Get a list of Git‑tracked directories (unique, sorted) +git_dirs=$(git ls-files | cut -d'/' -f1 | sort -u) - # 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 "![${png##*/}](${png})" >> $README_FILE - done +# Loop through each tracked directory +for dir in $git_dirs; do + # Ensure it's a directory + [ -d "$dir" ] || continue - # 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 + # Add the section header + echo -e "\n## ${dir}\n" >> "$README_FILE" + + # Embed PNG images + png_files=$(find "$dir" -maxdepth 1 -type f -name '*.png') + if [ -n "$png_files" ]; then + for png in $png_files; do + echo "![${png##*/}](${png})" >> "$README_FILE" + done + fi + + # Add links to Markdown files + md_files=$(find "$dir" -maxdepth 1 -type f -name '*.md') + if [ -n "$md_files" ]; then + echo -e "\nDocumentation:\n" >> "$README_FILE" + for md in $md_files; do + echo "* [${md##*/}](${md})" >> "$README_FILE" + done + fi + + # List .scad files + echo -e "\nModel files:\n" >> "$README_FILE" + scad_files=$(find "$dir" -type f -name '*.scad') + if [ -n "$scad_files" ]; then + for scad in $scad_files; do + # Strip leading directory component + echo "* ${scad#$dir/}" >> "$README_FILE" + done + fi done