1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/dist/tools/examples_check/check_in_readme.sh
AnnsAnn 83e93a5b73 ci: Add tests for examples folder
examples/readme: add missing entries

examples: document examples with no readme
2024-11-12 16:35:26 +01:00

31 lines
782 B
Bash
Executable File

#!/bin/bash
# Path to the examples directory
EXAMPLES_DIR="$(dirname "$0")/../../../examples"
# Path to the README.md file
README_FILE="$EXAMPLES_DIR/README.md"
# Get a list of all directories in the examples directory
directories=$(find "$EXAMPLES_DIR" -maxdepth 1 -mindepth 1 -type d -exec basename {} \;)
# Check each directory
missing_entries=()
for dir in $directories; do
if ! grep -q "$dir" "$README_FILE"; then
missing_entries+=("$dir")
fi
done
# Report missing entries
if [ ${#missing_entries[@]} -eq 0 ]; then
echo "All directories are listed in the README.md file."
exit 0
else
echo "The following directories are missing in the README.md file:"
for entry in "${missing_entries[@]}"; do
echo "- $entry"
done
exit 1
fi