Continued work on loosening note definition; added framework for color in errors.

This commit is contained in:
Jon-William Lewis
2016-02-15 00:55:29 -06:00
parent 2b77e325ae
commit faab86dff2
4 changed files with 73 additions and 73 deletions

View File

@@ -1,42 +1,42 @@
#==============================================================================
# Section: Actions / Stage 3
#==============================================================================
# Default behavior
# If no operation was specified, print help and exit on ERR_NO_OP
if [ "$OP" != "TRUE" ]; then
help; exit 20
fi
# All options not requiring at least a notebook to be specified have been dealt
# with; if one isn't specified, exit on ERR_NO_NOTEBOOK.
if [ -z "$NOTEBOOK" ]; then
printf "\n%s\n %s\n" "ERROR: Insufficient arguments:" "Notebook not 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"
exit 30
fi
#==============================================================================
# Section: Actions / Stage 3
#==============================================================================
# Default behavior
# If no operation was specified, print help and exit on ERR_NO_OP
if [ "$OP" != "TRUE" ]; then
help; exit 20
fi
# 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"
exit 30
fi
NOTE_DIR="$NOTES_DIR"/"$NOTEBOOK"/"$SECTION"
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"
else
readonly NOTE="$NOTE_DIR/$NAME.$EXT"
fi
if [ "$ENCRYPTION" == "TRUE" ]; then
SESSION_ID="$RANDOM" #SESSION_ID later becomes the temporary filename
readonly NOTE="$NOTE_DIR/$NAME.$EXT.gpg"
else
readonly NOTE="$NOTE_DIR/$NAME.$EXT"
fi
if [ "$PRINT" == "TRUE" ]; then print; exit 0; fi
if [ "$DELETE" == "TRUE" ]; then delete; exit 0; fi
if [ "$CREATE" == "TRUE" ]; then create; fi
if [ "$EDIT" == "TRUE" ]; then edit; fi
if [ "$PRINT" == "TRUE" ]; then print; exit 0; fi
if [ "$DELETE" == "TRUE" ]; then delete; exit 0; fi
if [ "$CREATE" == "TRUE" ]; then create; fi
if [ "$EDIT" == "TRUE" ]; then edit; fi
#==============================================================================
# End Section: Actions / Stage 3
#==============================================================================
#==============================================================================
# End Section: Actions / Stage 3
#==============================================================================