aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-02-19 21:24:27 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-02-19 21:24:27 -0300
commitb06f58a19dca8d63328eeea6a6b435233936ba2a (patch)
tree13b43423bedff4425e18e40585f240b2a2c268ff
parentaae23818ae3524270a41518237d47ec1a0dd88e2 (diff)
downloadscripts-b06f58a19dca8d63328eeea6a6b435233936ba2a.tar.gz
scripts-b06f58a19dca8d63328eeea6a6b435233936ba2a.tar.bz2
Feat: keyringer-export-pads: support for a single pad
-rwxr-xr-xkeyringer-export-pads22
1 files changed, 16 insertions, 6 deletions
diff --git a/keyringer-export-pads b/keyringer-export-pads
index 34837cb..167c3a6 100755
--- a/keyringer-export-pads
+++ b/keyringer-export-pads
@@ -9,17 +9,27 @@
#source "$LIB" maintenance $* || exit 1
# Parameters
-KEYRING="$1"
BASENAME="`basename $0`"
+KEYRING="$1"
+PAD="$2"
+
+# Procedure
+function keyringer_export_pad {
+ torify curl `keyringer $KEYRING decrypt pads/urls/$1 main 2> /dev/null`/export/txt | keyringer $KEYRING encrypt pads/exports/$1
+}
# Check
if [ -z "$KEYRING" ]; then
- echo "usage: $BASENAME <keyring>"
+ echo "usage: $BASENAME <keyring> [pad]"
exit 1
fi
# Dispatch
-for pad in `keyringer $KEYRING ls pads/urls`; do
- echo "Exporting $pad..."
- torify curl `keyringer $KEYRING decrypt pads/urls/$pad main 2> /dev/null`/export/txt | keyringer $KEYRING encrypt pads/exports/$pad
-done
+if [ -z "$PAD" ]; then
+ for pad in `keyringer $KEYRING ls pads/urls`; do
+ echo "Exporting $pad..."
+ done
+else
+ echo "Exporting $PAD..."
+ keyringer_export_pad $PAD
+fi