From 4a71dd0ae88a264b43aa2b33aa98433c47867ba4 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Mon, 4 Jul 2022 19:08:37 +0800 Subject: [PATCH] Better ##makedesc parsing --- Makefile | 2 +- gen-makefile.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3425097..5216964 100644 --- a/Makefile +++ b/Makefile @@ -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: diff --git a/gen-makefile.sh b/gen-makefile.sh index 9e26279..99c27bc 100755 --- a/gen-makefile.sh +++ b/gen-makefile.sh @@ -1,11 +1,11 @@ #!/bin/bash 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 name=${file##*/} 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='' echo -e "## ${name}: ${desc}\n${name}:\n\t${file}\n" >> Makefile done;