From 763235d79efa26963af8781601f6d2a8acae8ea7 Mon Sep 17 00:00:00 2001 From: Jan-Piotraschke Date: Fri, 19 Apr 2024 12:37:14 +0200 Subject: [PATCH] presenting the message of the requirements as their own column --- scripts/summarize_requirements.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scripts/summarize_requirements.sh b/scripts/summarize_requirements.sh index ba7ab6e..e5c3726 100755 --- a/scripts/summarize_requirements.sh +++ b/scripts/summarize_requirements.sh @@ -13,13 +13,17 @@ done < <(git log --pretty=format:%s) find . -name "requirements.md" | sort | while read file; do directory=$(dirname "$file") echo "## Requirements from $directory" >> SUMMARY.md - echo "| Requirement ID | Present in Git History |" >> SUMMARY.md - echo "|----------------|------------------------|" >> SUMMARY.md + echo "| Requirement ID | Description | Present in Git History |" >> SUMMARY.md + echo "|----------------|-------------|-----------------------|" >> SUMMARY.md # Ensure that all lines, including those that might end without a newline, are read while IFS= read -r line || [[ -n "$line" ]]; do [[ -z "$line" ]] && continue # Skip empty lines # Extract requirement ID req_id=$(echo "$line" | grep -o '\[.*\]') + # Escape brackets for use in sed + escaped_req_id=$(echo "$req_id" | sed 's/[][]/\\&/g') + # Extract the description text + description=$(echo "$line" | sed -e "s/^$escaped_req_id //") # Initialize a flag to false found="No" # Check if the requirement ID is present in any commit message @@ -29,7 +33,7 @@ find . -name "requirements.md" | sort | while read file; do break fi done - echo "| $line | $found |" >> SUMMARY.md + echo "| $req_id | $description | $found |" >> SUMMARY.md done < "$file" echo "" >> SUMMARY.md done