Witze durch 25–30 echte Programmierer-Zitate ersetzt (Linus Torvalds, Donald Knuth, Brian Kernighan u.a.). Verzeichnis, Datei und alle Referenzen umbenannt. Demo-Befehle auf Zitate-Konzept angepasst. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
55 lines
1.9 KiB
Bash
Executable file
55 lines
1.9 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Stellt den Ausgangszustand aller Examples wieder her.
|
|
# Löscht erzeugte Sub-Repos, restauriert Quelldateien aus dem Haupt-Repo
|
|
# und bereinigt Build-Artefakte.
|
|
#
|
|
# Optionen:
|
|
# --reset-protokoll Setzt auch PROTOKOLL.md auf leere Templates zurück.
|
|
# Standard: PROTOKOLL.md bleibt unangetastet.
|
|
|
|
set -euo pipefail
|
|
|
|
ROOT="$(git -C "$(dirname "$0")" rev-parse --show-toplevel)"
|
|
EXAMPLES="$ROOT/examples"
|
|
RESET_PROTOKOLL=false
|
|
|
|
for arg in "$@"; do
|
|
[ "$arg" = "--reset-protokoll" ] && RESET_PROTOKOLL=true
|
|
done
|
|
|
|
echo "Stelle Examples-Ausgangszustand wieder her..."
|
|
|
|
for dir in python-calculator rust-wordcount go-fibonacci c-linkedlist bash-sysreport html-quote-ticker; do
|
|
path="$EXAMPLES/$dir"
|
|
if [ -d "$path/.git" ]; then
|
|
rm -rf "$path/.git"
|
|
echo " ✓ Sub-Repo entfernt: $dir"
|
|
fi
|
|
# Quelldateien restaurieren — PROTOKOLL.md standardmäßig ausnehmen
|
|
while IFS= read -r file; do
|
|
git -C "$ROOT" checkout -- "$file"
|
|
done < <(git -C "$ROOT" ls-files "examples/$dir/" \
|
|
| grep -v '/PROTOKOLL\.md$')
|
|
if $RESET_PROTOKOLL; then
|
|
git -C "$ROOT" checkout -- "examples/$dir/PROTOKOLL.md"
|
|
echo " ✓ Dateien restauriert: $dir (inkl. PROTOKOLL.md)"
|
|
else
|
|
echo " ✓ Dateien restauriert: $dir (PROTOKOLL.md behalten)"
|
|
fi
|
|
done
|
|
|
|
# Build-Artefakte und pi-coder-Laufzeitartefakte bereinigen
|
|
rm -rf "$EXAMPLES/rust-wordcount/target"
|
|
find "$EXAMPLES" -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
|
|
find "$EXAMPLES" -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
|
|
find "$EXAMPLES" -name "ll_demo" -delete 2>/dev/null || true
|
|
find "$EXAMPLES" -name "TASK.md" -delete 2>/dev/null || true
|
|
|
|
echo ""
|
|
echo "Fertig. Alle Examples sind im Ausgangszustand."
|
|
if $RESET_PROTOKOLL; then
|
|
echo "PROTOKOLL.md-Dateien wurden auf leere Templates zurückgesetzt."
|
|
else
|
|
echo "PROTOKOLL.md-Dateien wurden nicht verändert."
|
|
echo "Für leere Templates: $0 --reset-protokoll"
|
|
fi
|