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