Better ##makedesc parsing

This commit is contained in:
Anthony Axenov 2022-07-04 19:08:37 +08:00
parent ad34d5c64a
commit 4a71dd0ae8
Signed by: anthony
GPG Key ID: EA9EC32FF7CCD4EC
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
# Autogenerated at 04.07.2022 17:32 by ./gen-makefile.sh # Autogenerated at 04.07.2022 19:08 using ./gen-makefile.sh
## apache: Install apache2 (latest) ## apache: Install apache2 (latest)
apache: apache:

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
mv Makefile Makefile.bak mv Makefile Makefile.bak
echo -e "# Autogenerated at $(date +'%d.%m.%Y %H:%M') by ${BASH_SOURCE[0]}\n" > Makefile echo -e "# Autogenerated at $(date +'%d.%m.%Y %H:%M') using ${BASH_SOURCE[0]}\n" > Makefile
for file in ./install/*.sh; do for file in ./install/*.sh; do
name=${file##*/} name=${file##*/}
name=${name%.sh} name=${name%.sh}
desc=$(cat ${file} | sed -n 2p | sed -n 's/^##makedesc: //p') desc=$(grep -m 1 -oP "(?<=^##makedesc:\s).*$" ${file})
[ -z "$desc" ] && desc='<no description>' [ -z "$desc" ] && desc='<no description>'
echo -e "## ${name}: ${desc}\n${name}:\n\t${file}\n" >> Makefile echo -e "## ${name}: ${desc}\n${name}:\n\t${file}\n" >> Makefile
done; done;