commit b405604a7c55ca81eeb6e090bce551d66a61313b
parent f3182a5677818ad0b48a19038d14f4a121bd69e4
Author: Alex Balgavy <alex@balgavy.eu>
Date: Thu, 20 May 2021 11:11:14 +0200
lfrc: support decrypting both .pgp and .gpg files
Diffstat:
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lf/lfrc b/lf/lfrc
@@ -208,7 +208,6 @@ cmd trash %{{
case "$ans" in
Y*|y*) trash "$f"; printf "Deleted $f.";;
A*|a*) trash $fx; printf "Deleted all files."; break;;
- *) printf "Not deleting $f"; sleep 1;;
esac
done
}}
@@ -238,7 +237,12 @@ cmd pgp_encrypt_pass ${{
}}
cmd pgp_decrypt ${{
- gpg --output ${f%.gpg} --decrypt $f
+ case "$f" in
+ *.gpg) outfile="${f%.gpg}";;
+ *.pgp) outfile="${f%.pgp}";;
+ *) outfile="decrypted-${f}";;
+ esac
+ gpg --output "$outfile" --decrypt "$f"
}}
# Encode input into binary or ASCII-armored output with an integrated signature