Formatting changes
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user