Address code review feedback: improve find commands

Co-authored-by: kuhyx <147418882+kuhyx@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot] 2026-01-07 22:28:18 +00:00
parent ef617c8810
commit b42c90572b

View File

@ -64,9 +64,7 @@ for track in "${!TRACKS[@]}"; do
# Show exercise count # Show exercise count
if [[ -d "$track/exercises/practice" ]]; then if [[ -d "$track/exercises/practice" ]]; then
count=$(find "$track/exercises/practice" -maxdepth 1 -type d | wc -l) count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d | wc -l)
# Subtract 1 for the parent directory itself
count=$((count - 1))
echo "$count practice exercises available" echo "$count practice exercises available"
fi fi
echo "" echo ""
@ -102,9 +100,7 @@ echo ""
echo "Track summary:" echo "Track summary:"
for track in "${!TRACKS[@]}"; do for track in "${!TRACKS[@]}"; do
if [[ -d "$track/exercises/practice" ]]; then if [[ -d "$track/exercises/practice" ]]; then
count=$(find "$track/exercises/practice" -maxdepth 1 -type d 2> /dev/null | wc -l) count=$(find "$track/exercises/practice" -mindepth 1 -maxdepth 1 -type d 2> /dev/null | wc -l)
# Subtract 1 for the parent directory itself
count=$((count - 1))
printf " %-15s %3d exercises\n" "$track" "$count" printf " %-15s %3d exercises\n" "$track" "$count"
fi fi
done | sort done | sort