Made changes to create and delete functions reflecting recent design decisions

This commit is contained in:
Jon-William Lewis
2016-02-15 01:18:44 -06:00
parent faab86dff2
commit 037fd9c2fa
3 changed files with 27 additions and 31 deletions

View File

@@ -9,29 +9,20 @@
# All options not requiring a note to be specified have been dealt
# with; if one isn't specified, exit on ERR_NO_NOTE.
if [ -z "$NOTE" ]; then
printf " $RED_COLOR!$RESET_COLOR %s\n" "No note specified."
exit 30
fi
# List is the only option requiring only a notebook.
# If list isn't the selected option and no note name was specified, throw code 30.
if [ "$LIST" == TRUE ]; then
list
exit 0
elif [ -z "$NAME" ]; then
printf "\n%s\n %s\n" "ERROR: Insufficient arguments:" "Notebook not specified"
printf " $RED_COLOR!$RESET_COLOR %s\n" "No note specified."
exit 30
fi
NOTE_DIR="$NOTES_DIR"/"$NOTEBOOK"/"$SECTION"
if [ "$ENCRYPTION" == "TRUE" ]; then
SESSION_ID="$RANDOM" #SESSION_ID later becomes the temporary filename
readonly NOTE="$NOTE_DIR/$NAME.$EXT.gpg"
readonly NOTE="$NOTE.$EXT.gpg"
else
readonly NOTE="$NOTE_DIR/$NAME.$EXT"
readonly NOTE="$NOTE.$EXT"
fi
if [ "$LIST" == "TRUE" ]; then list; exit 0; fi
if [ "$PRINT" == "TRUE" ]; then print; exit 0; fi
if [ "$DELETE" == "TRUE" ]; then delete; exit 0; fi
if [ "$CREATE" == "TRUE" ]; then create; fi