Fix typo and include nvi* editors

This commit is contained in:
Felix Van der Jeugt 2020-04-15 12:34:59 +02:00
parent af6b855bc3
commit f44386d730
No known key found for this signature in database
GPG Key ID: 58B209295023754D

View File

@ -43,12 +43,12 @@ selection="$(sed -n 's/....-..-..\( [*!]\)\? //p' "${@:-$LEDGER_FILE}" | sort |
sed -n "/....-..-..\( [*!]\)\? ${selection}\$/,/^\$/p" "${@:-$LEDGER_FILE}" | # print matching transactions sed -n "/....-..-..\( [*!]\)\? ${selection}\$/,/^\$/p" "${@:-$LEDGER_FILE}" | # print matching transactions
sed '${/^$/d}' | # remove trailing empty line sed '${/^$/d}' | # remove trailing empty line
sed -n '/^$/{s/.*//;x;d};H;${x;p}' | # remove all before the last empty line sed -n '/^$/{s/.*//;x;d};H;${x;p}' | # remove all before the last empty line
sed "s/^....-..-..\( [*!]\)\?/$(date +'%Y-%m-%d')/" | # replace date iwht today, remove marker sed "s/^....-..-..\( [*!]\)\?/$(date +'%Y-%m-%d')/" | # replace date with today, remove marker
sponge -a "$add_file" # append to the file, use sponge in case it's also an input file sponge -a "$add_file" # append to the file, use sponge in case it's also an input file
# review change: open end of the file (if I know how) # review change: open end of the file (if I know how)
case "$EDITOR" in case "$EDITOR" in
vi*) "$EDITOR" +\$ "$add_file" ;; vi*|nvi*) "$EDITOR" +\$ "$add_file" ;;
emacs) "$EDITOR" "$add_file" -f end-of-buffer ;; emacs) "$EDITOR" "$add_file" -f end-of-buffer ;;
*) "$EDITOR" "$add_file" ;; *) "$EDITOR" "$add_file" ;;
esac esac