mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 08:41:34 +02:00
Add gpe(gpg wrapper) for ranger
This commit is contained in:
parent
633e8ad6cd
commit
71ddd0ad2f
7 changed files with 61 additions and 14 deletions
24
bin/gpe
Executable file
24
bin/gpe
Executable file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/env bash
|
||||
# For working this script set in $GPG_KEY you gpg key
|
||||
## Functions
|
||||
function encrypt() {
|
||||
gpg -ea -r $GPG_KEY $@
|
||||
}
|
||||
function decrypt() {
|
||||
local fn="$1"
|
||||
|
||||
if [ ${fn: -4} == ".asc" ]
|
||||
then
|
||||
gpg -d -o ${fn%%.asc} $@
|
||||
elif [ ${fn: -4} == ".gpg" ]
|
||||
then
|
||||
gpg -d -o ${fn%%.gpg} $@
|
||||
fi
|
||||
}
|
||||
|
||||
## Logic
|
||||
case "$1" in
|
||||
enc|e) shift; encrypt $@ ;;
|
||||
dec|d) shift; decrypt $@ ;;
|
||||
*) echo "Error." ;;
|
||||
esac
|
||||
Loading…
Add table
Add a link
Reference in a new issue