Automatic readme generation

This commit is contained in:
Jeremy Soller
2019-03-18 10:37:42 -06:00
parent 3d15eb7c35
commit 6a2f1b2ea7
7 changed files with 57 additions and 7 deletions

View File

@@ -1,2 +1,8 @@
# firmware-open
System76 Open Source Firmware
- [Applications](./apps/README.md)
- [Libraries](./libs/README.md)
- [Models](./models/README.md)
- [Tools](./tools/README.md)

3
apps/README.md Normal file
View File

@@ -0,0 +1,3 @@
# Applications
- [System76 Firmware Setup](https://github.com/system76/firmware-setup.git)
- [System76 Firmware Update](https://github.com/system76/firmware-update.git)

6
libs/README.md Normal file
View File

@@ -0,0 +1,6 @@
# Libraries
- [coreboot-table](https://gitlab.redox-os.org/redox-os/coreboot-table.git)
- [ecflash](https://github.com/system76/ecflash.git)
- [intelflash](https://gitlab.redox-os.org/redox-os/intelflash.git)
- [intel-spi](https://github.com/system76/intel-spi.git)
- [uefi_std](https://gitlab.redox-os.org/redox-os/uefi_std.git)

View File

@@ -1,6 +0,0 @@
echo "# Models" > README.md
for readme in ./*/README.md
do
line="$(head -n 1 "$readme" | cut -d ' ' -f2-)"
echo "- [$line]($readme)" >> README.md
done

35
readme.sh Executable file
View File

@@ -0,0 +1,35 @@
#!/usr/bin/env bash
READMES=(
"apps Applications"
"libs Libraries"
"models Models"
"tools Tools"
)
function recursive_readme {
pushd "$1" > /dev/null
echo -e "\x1B[1m$1\x1B[0m"
echo "# $2" > README.md
for readme in */README.md
do
# Get first line, removing the trailing pounds and spaces
description="$(head -n 1 "$readme" | sed -e 's/^[#[:space:]]*//')"
# Get submodule, if applicable
dir="$(dirname "$readme")"
submodule="$(git submodule status "$dir" | cut -d ' ' -f 3)"
if [ "$submodule" == "$dir" ]
then
origin="$(git -C "$dir" remote get-url origin)"
echo "- [$description]($origin)" >> README.md
else
echo "- [$description](./$readme)" >> README.md
fi
done
popd > /dev/null
}
for readme in "${READMES[@]}"
do
recursive_readme $readme
done

6
tools/README.md Normal file
View File

@@ -0,0 +1,6 @@
# Tools
- [coreboot-collector](https://github.com/system76/coreboot-collector.git)
- [ME Analyzer](https://github.com/platomav/MEAnalyzer.git)
- [UEFITool](https://github.com/LongSoft/UEFITool.git)
- [Intel ME 11.x Firmware Images Unpacker](https://github.com/ptresearch/unME11.git)
- [Intel ME 12.x Firmware Images Unpacker](https://github.com/ptresearch/unME12.git)