update script -> readme

This commit is contained in:
2025-07-10 13:51:19 +03:00
parent 9de26bb595
commit 733c96cd36
2 changed files with 25 additions and 3 deletions

View File

@@ -3,9 +3,10 @@ set -euo pipefail
OUT="README.md"
# Header & TOC
# Header + hidden anchor + TOC
cat > "$OUT" <<EOF
# Wallpapers Collection
<a name="top"></a>
## Table of Contents
EOF
@@ -20,7 +21,7 @@ done
echo -e "\n---\n" >> "$OUT"
# Folders with image entries
# Sections for each folder and images
for dir in */; do
dir_name="${dir%/}"
anchor=$(printf '%s' "$dir_name" \
@@ -30,11 +31,13 @@ for dir in */; do
echo "## ${dir_name}" >> "$OUT"
echo "" >> "$OUT"
echo "**[⇧ back to top](#top)**" >> "$OUT"
echo "" >> "$OUT"
for img in "${dir}"*.{png,jpg,jpeg,gif}; do
[ -f "$img" ] || continue
fn="$(basename "${img%.*}")"
rel="$(echo "$img" | sed 's|^\./||')"
# Get filesize in human-readable format
size=$(du -h "$img" | cut -f1)
echo "### ${fn} — _${size}_ " >> "$OUT"