Updated vns_merge to use new vns_gpgid recipients

This commit is contained in:
Vera Lewis
2024-03-31 02:14:21 -05:00
parent 1b4a3ff549
commit 2bcbf830d4

21
vns
View File

@@ -346,10 +346,11 @@ vns_merge () {
if [ -r "$VNS_STORE/$1.gpg" ]; then vns_raise "Output file already exists." 82; fi
if [ ! -r "$VNS_STORE/$2.gpg" ]; then vns_raise "Could not read $2" 83; fi
local GPG_OPTS=()
for recip in $(gpg --list-only -v -d "${VNS_STORE}/$2.gpg" 2>&1 | awk '/public key is/{print $5}'); do
GPG_OPTS=( "${GPG_OPTS[@]}" -r "$recip" )
done
#local GPG_OPTS=()
#for recip in $(gpg --list-only -v -d "${VNS_STORE}/$2.gpg" 2>&1 | awk '/public key is/{print $5}'); do
# GPG_OPTS=( "${GPG_OPTS[@]}" -r "$recip" )
#done
local -r NOTE_NAME="$1"
local -r OUTPUT="${VNS_STORE}/${1}.gpg"
shift
@@ -361,14 +362,12 @@ vns_merge () {
fi
printf "File: %s\n" "$note"
gpg2 --batch -d "$VNS_STORE/$note.gpg"
gpg2 --batch -d "$VNS_STORE/$note.gpg" 2>/dev/null
printf "\n"
done
}
vns_gpgcat "$@" | gpg2 --batch --yes "${GPG_OPTS[@]}" --encrypt -o "$VNS_STORE/$OUTPUT.gpg"
vns_git add "$VNS_STORE/$1.gpg"
vns_gpgcat "$@" | gpg2 --batch --yes "$(vns_gpgid)" --encrypt -o "$OUTPUT"
printf "%s" "Remove old notes? (y/N) "
local response=''; read -r response
@@ -378,9 +377,9 @@ vns_merge () {
vns_git rm "$VNS_STORE/$note.gpg"
done;;
esac
vns_git add "$VNS_STORE/$OUTPUT.gpg"
vns_git commit -m "merged files $OUTPUT $* into $OUTPUT"
vns_report "Successfully merged files $OUTPUT $* into $OUTPUT"
vns_git add "$OUTPUT" >/dev/null 2>&1
vns_git commit -m "merged files $* into $NOTE_NAME" >/dev/null 2>&1
vns_report "Successfully merged files $* into $NOTE_NAME"
}
vns_duplicate () {