aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/gpgd
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gpgd')
-rwxr-xr-xplugins/gpgd11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/gpgd b/plugins/gpgd
index 0fd3c8d..0dde588 100755
--- a/plugins/gpgd
+++ b/plugins/gpgd
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
# Description: Decrypts selected files using gpg. The contents of the decrypted file are stored in a file with extension .dec
#
@@ -9,7 +9,14 @@
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
-files=$(tr '\0' '\n' < "$selection")
+printf "(s)election/(c)urrent? [default=c] "
+read -r resp
+
+if [ "$resp" = "s" ]; then
+ files=$(tr '\0' '\n' < "$selection")
+else
+ files=$1
+fi
printf "%s" "$files" | xargs -n1 -I{} gpg --decrypt --output "{}.dec" {}