From 3592e5b055ad0fcd70d1ae9e4804a4b5c6a77c5d Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Thu, 28 Sep 2023 16:45:47 +0200 Subject: add list, show commands The `list` command can be omitted and is the default. The `show` command retains past output. ```console $ anissue -h Usage: anissue anissue list anissue show ``` The implementation uses docopts, the shell variant of docopt [1]. Because of that, wrapping with `--argv0 ''` is necessary when packaging. [1] http://docopt.org/ --- src/extract.sh | 32 -------------------------------- 1 file changed, 32 deletions(-) (limited to 'src/extract.sh') diff --git a/src/extract.sh b/src/extract.sh index 1e8440d..6422694 100755 --- a/src/extract.sh +++ b/src/extract.sh @@ -42,14 +42,6 @@ # # @assigned kirchner@posteo.de -# TODO Add command line modes list and show -# -# `anissue list` lists all issues in the current directory -# `anissue show ` shows an issue using it's id or automatically -# assigned identifier -# -# @assigned aforemny - # TODO Generate and show hash for each issue @@ -115,28 +107,4 @@ git ls-files --cached --exclude-standard --other | "heading": $heading, "start_row": $start_row }' - done | while read -r item; do - created_at=$(echo "$item" | jq -r .created_at) - file=$(echo "$item" | jq -r .file) - heading=$(echo "$item" | jq -r .heading) - body=$(echo "$item" | jq -r .body) - start_row=$(echo "$item" | jq -r .start_row) - end_row=$(echo "$item" | jq -r .end_row) - - 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