From ebd9664313c0a1984fc9a06d0e247e4832212957 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Tue, 5 Sep 2023 15:49:19 +0200 Subject: *.sh -> src --- extract.sh | 58 ---------------------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100755 extract.sh (limited to 'extract.sh') diff --git a/extract.sh b/extract.sh deleted file mode 100755 index ba611d3..0000000 --- a/extract.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -set -efu - -input_dir=$1 - -find "$input_dir" -type f | - while read -r input_file; do - ext= - case $input_file in - *.elm) ext="elm" ;; - *.nix) ext="nix" ;; - *) ;; - esac - - if test -z $ext; then - echo "warning, file $input_file ignored" >&2 - continue - fi - - ./extract-$ext.sh "$input_file" - done | - while read -r item; do - start_row=$(echo "$item" | jq '.match.start.row') - end_row=$(echo "$item" | jq '.match.end.row') - - last_commit=$(echo "$item" | jq '.last_commit' -r) - text=$(echo "$item" | jq '.text' -r) - file=$(echo "$item" | jq '.file' -r) - - 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 -- cgit v1.2.3