Formatting changes

This commit is contained in:
Jon-William Lewis
2016-02-10 23:34:49 -06:00
parent be3871f859
commit 856b14242c
14 changed files with 267 additions and 282 deletions

View File

@@ -1,15 +1,20 @@
function edit(){
# Requires: $EDITOR, $NOTE
# Optional: $ENCRYPTION, $TMP_DIR, $SESSION_ID, decrypt, encrypt
# Verify an editor was specified
if [ -z "$EDITOR" ]; then
>&2 echo "Error no editor specified in environment."
exit
# Verify the note exists
elif [ ! -r "$NOTE" ]; then
echo "ERROR: Note cannot be opened for editing."
exit 40;
fi
# When encryption is enabled, decrypt $NOTE to a temp file
if [ "$ENCRYPTION" == "TRUE" ]; then
cp "$NOTE" "$NOTE".bk
if [ ! -d "$ROOT_DIR"/tmp ]; then mkdir "$ROOT_DIR"/tmp; fi
cp "$NOTE" "$NOTE".bk #Insurance
if [ ! -d "$TMP_DIR" ]; then mkdir "$TMP_DIR"; fi
TMP_NOTE="$TMP_DIR/$SESSION_ID"
decrypt > "$TMP_NOTE"
else TMP_NOTE="$NOTE"; fi