From 4c019f382762f55e9595b151e186cf360d0605fa Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 5 Sep 2023 14:11:26 +0200 Subject: drop issues.sh its functionality has been refactored into extract.sh and helpers --- issues.sh | 65 --------------------------------------------------------------- 1 file changed, 65 deletions(-) delete mode 100755 issues.sh diff --git a/issues.sh b/issues.sh deleted file mode 100755 index 0c3f761..0000000 --- a/issues.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash - -set -efu - -tree-grepper \ - -q elm '([(line_comment) (block_comment)]+)' \ - --format json frontend/src/ | \ - jq 'sort_by(.file)' | \ - jq '.[]' --indent 0 | \ - while read -r line; do - file=$(echo "$line" | jq -r .file) - file_type=$(echo "$line" | jq -r .file_type) - items=$(echo "$line" | \ - jq '.matches[] | { file: $file, file_type: $file_type, match: . }' --arg file "$file" --arg file_type "$file_type" | \ - jq '. | select(.match.text | test("TODO .+"))' - ) - if test -z "$items"; then - continue - fi - - echo "$items" | jq --slurp '.[]' --indent 0 | \ - while read -r item; do - start_row=$(echo "$item" | jq '.match.start.row') - end_row=$(echo "$item" | jq '.match.end.row') - - last_commit=$(git --no-pager blame -L "$start_row,$start_row" "$file" -p | \ - head -n 1 | \ - cut -d ' ' -f 1 - ) - - text=$(echo "$item" | \ - jq .match.text -r | \ - sed 's/^-- //' | \ - sed 's/^{- //' | \ - sed 's/ -}$//') - - first_commit=$(git --no-pager log --reverse -S"$text" --format=%H | \ - head -n 1) - - created_at=$(git show $first_commit --no-patch --format=%ad) - heading=$(echo "$text" | sed '/^$/Q' | sed 's/.*TODO //') - body=$(echo "$text" | tail -n +$(($(echo "$heading" | wc -l) + 2)) | \ - awk -F '[^ ]' ' - NR == 1 {n = length($1)} - {sub("^ {1,"n"}", ""); print}' - ) - - GREEN='\033[0;32m' - BOLD=$(tput bold) - NORMAL=$(tput sgr0) - NC='\033[0m' - echo -e "$GREEN--- $created_at --- $file$NC" - echo - echo "$BOLD$heading$NORMAL" | fold -s - if test -n "$body"; then - echo - echo "$body" | fold -s - echo - fi - echo - cat "$file" | nl -w 4 -s "| " -p -d '' -b a| tail -n +$(($start_row - 2)) | head -n $(($end_row - $start_row + 7)) - echo - echo - done - done -- cgit v1.2.3