aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/gpgd
diff options
context:
space:
mode:
authorGravatar KlzXS <azszwymmvqdi@yahoo.com>2020-06-04 14:51:50 +0000
committerGravatar GitHub <noreply@github.com>2020-06-04 20:21:50 +0530
commit1f3ce3ae941190d6664222ef8b544468e0261bbd (patch)
treef291feaf5824be8e82cfe97e8ffa442d7b6d726f /plugins/gpgd
parent10a43a4fbbff5277f9829a76c1e31f0bc7b44089 (diff)
downloadnnn-1f3ce3ae941190d6664222ef8b544468e0261bbd.tar.gz
Added selection prompt and README entry (#633)
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" {}