Added licensing information (GPLv2) and began importing completion code

from pass.
This commit is contained in:
Jon-William Lewis
2016-02-15 15:58:26 -06:00
parent bc3cc7661c
commit 0be408290d
5 changed files with 395 additions and 328 deletions

View File

@@ -8,7 +8,7 @@ if [ -z "$EDITOR" ]; then
"No editor specified in environment."
exit
# Verify the note exists
elif [ ! -r "$NOTE" ]; then
elif [ ! -r "$NOTES_DIR/$NOTE" ]; then
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n"\
"Note cannot be opened for editing."
exit 40;
@@ -17,17 +17,17 @@ fi
# If encryption is enabled, decrypt $NOTE to a temp file, otherwise
# operate on the note directly.
if [ "$ENCRYPTION" == "TRUE" ]; then
cp "$NOTE" "$NOTE".bk #Insurance
cp "$NOTES_DIR/$NOTE" "$NOTES_DIR$/$NOTE".bk #Insurance
TMP_NOTE="$TMP_DIR/$SESSION_ID"
decrypt > "$TMP_NOTE"
else
TMP_NOTE="$NOTE";
TMP_NOTE="$NOTES_DIR/$NOTE";
fi
# Write an ammendment header
if [ -z "$CREATE" ]; then
printf "\n %s\n" "edit - $(date)" >> "$TMP_NOTE"
printf "\n %s\n" "===================================" >> "$TMP_NOTE"
printf "%s\n" "===================================" >> "$TMP_NOTE"
fi
# Call the editor
@@ -36,13 +36,13 @@ printf " - %s\n" "editing ${NOTE%.*}"
# If the file was previously decrypted, encrypt it back
if [ "$ENCRYPTION" == "TRUE" ]; then
rm "$NOTE"
rm "$NOTES_DIR/$NOTE"
encrypt;
if [ ! -r "$NOTE" ]; then
>&2 printf " $RED_COLOR!$RESET_COLOR %s\n" "error: note was not saved."
cp "$NOTE.bk" "$NOTE"
cp "$NOTES_DIR/$NOTE.bk" "$NOTES_DIR/$NOTE"
else
rm "$NOTE.bk";
rm "$NOTES_DIR/$NOTE.bk";
fi
fi