mail: Add mail- prefix to mail cli utilities
Rename mail utility programs (yet again), to be prefixed with `mail-` instead of `neomutt-`. Also did not substitute with other MUA like `aerc-` since these utilities are mostly independent of specific implementations. The very specific `neomutt-filer` implementation script I completely removed since for aerc the same can be achieved with a simple configuration option.
This commit is contained in:
parent
40a0d45d6c
commit
7289522380
4 changed files with 6 additions and 79 deletions
19
office/.local/bin/mail-renderhtml
Executable file
19
office/.local/bin/mail-renderhtml
Executable file
|
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/env bash
|
||||
# render html as markdown and display in glow, supports syntax highlighting
|
||||
# requires: html2text, glow or bat
|
||||
# author: CEUK
|
||||
|
||||
fpath=$(mktemp --suffix=-mail-render.html)
|
||||
|
||||
#shellcheck disable=SC2064 # we want to expand it instantly
|
||||
trap "rm -f -- ${fpath@Q}" EXIT
|
||||
|
||||
perl -0777pe 's/(<code class="sourceCode\s?)(\w+?)(">)(.*?)(<\/code>)/\1\2\3\n```\2\n\4\n```\n\5/gs' "$1" | html2text | sed -re 's/^\s+(```(\w+)?)/\1/gm' -e 's/\x1b\[[6-9;]*m//g' >"$fpath"
|
||||
|
||||
if command -v bat >/dev/null 2>&1; then
|
||||
bat "$fpath"
|
||||
elif command -v glow >/dev/null 2>&1; then
|
||||
glow -s ~/.config/glow/email.json "$fpath"
|
||||
else
|
||||
sed 's/\x1b\[[6-9;]*m//g' <"$fpath"
|
||||
fi
|
||||
Loading…
Add table
Add a link
Reference in a new issue