diff options
Diffstat (limited to 'src/extract.sh')
-rwxr-xr-x | src/extract.sh | 52 |
1 files changed, 0 insertions, 52 deletions
diff --git a/src/extract.sh b/src/extract.sh deleted file mode 100755 index cd5cb67..0000000 --- a/src/extract.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -set -efu - -git ls-files --cached --exclude-standard --other | - while read -r input_file; do - ext= - case $input_file in - *.elm) ext="elm" ;; - *.nix) ext="nix" ;; - *.sh) ext="sh" ;; - *) ;; - esac - - if test -z $ext; then - echo "warning, file $input_file ignored" >&2 - continue - fi - - "$(dirname "$0")"/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 -n '0,/^$/p') - body=$(echo "$text" | tail -n +$(($(echo "$heading" | wc -l) + 2))) - - echo "$item" | jq -c \ - --arg body "$body" \ - --arg created_at "$created_at" \ - --arg first_commit "$first_commit" \ - --arg heading "$heading" \ - --argjson end_row "$end_row" \ - --argjson start_row "$start_row" \ - '. + { - "body": $body, - "created_at": $created_at, - "end_row": $end_row, - "first_commit": $first_commit, - "heading": $heading, - "start_row": $start_row - }' - done |