[zsh] Add gpg-crypt commands.

This commit is contained in:
Keanu Timmermans 2021-05-10 16:05:55 +02:00
parent b7454a658b
commit 47d365b837
Signed by: keanucode
GPG Key ID: A7431C0D513CA93B
1 changed files with 22 additions and 0 deletions

View File

@ -102,3 +102,25 @@ sudoedit() {
}
alias sudoe="sudoedit"
alias sue="sudoedit"
# gpg-crypt {{{
# Encrypt the given file or directory to a given recipient
function gpg-encrypt() {
if [ "$#" -ne 2 ]; then
echo "Usage: $0 FILE/DIRECTORY RECIPIENT" >&2
return 1
fi
tar -c `basename $1` | gpg --encrypt --recipient $2 -o `basename $1`.tar.gpg
}
# Decrypt the given tar.gpg file
function gpg-decrypt() {
if [ "$#" -ne 1 ] || [[ "$1" != *.tar.gpg ]]; then
echo "Usage: $0 FILE.tar.gpg" >&2
return 1
fi
gpg --quiet --decrypt $1 | tar -x
}
# }}}