diff options
-rwxr-xr-x | keyringer-export-pads | 22 |
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 |