Redirect user-directed warnings to stderr

This commit is contained in:
Nathan Henrie 2023-02-21 12:42:19 -07:00
parent 5f66c8aa77
commit d84a99d0b8

View file

@ -118,7 +118,7 @@ function edit {
fi fi
fi fi
if [[ "${DECRYPT[*]}" != *"--identity"* ]]; then if [[ "${DECRYPT[*]}" != *"--identity"* ]]; then
echo "No identity found to decrypt $FILE. Try adding an SSH key at $HOME/.ssh/id_rsa or $HOME/.ssh/id_ed25519 or using the --identity flag to specify a file." >&2 echo "No identity found to decrypt $FILE. Try adding an SSH key at $HOME/.ssh/id_rsa or $HOME/.ssh/id_ed25519 or using the --identity flag to specify a file."
exit 1 exit 1
fi fi
DECRYPT+=(-o "$CLEARTEXT_FILE" "$FILE") DECRYPT+=(-o "$CLEARTEXT_FILE" "$FILE")
@ -132,10 +132,10 @@ function edit {
if [ ! -f "$CLEARTEXT_FILE" ] if [ ! -f "$CLEARTEXT_FILE" ]
then then
echo "$FILE wasn't created." >&2 echo "$FILE wasn't created."
return return
fi fi
[ -f "$FILE" ] && [ "$EDITOR" != ":" ] && @diffBin@ "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" 1>/dev/null && echo "$FILE wasn't changed, skipping re-encryption." && return [ -f "$FILE" ] && [ "$EDITOR" != ":" ] && @diffBin@ "$CLEARTEXT_FILE.before" "$CLEARTEXT_FILE" 1>/dev/null && >&2 echo "$FILE wasn't changed, skipping re-encryption." && return
ENCRYPT=() ENCRYPT=()
while IFS= read -r key while IFS= read -r key
@ -158,7 +158,7 @@ function rekey {
for FILE in $FILES for FILE in $FILES
do do
echo "rekeying $FILE..." >&2 echo "rekeying $FILE..."
EDITOR=: edit "$FILE" EDITOR=: edit "$FILE"
cleanup cleanup
done done