Fixed erroneous reference to former static ~/.sns BASEDIR

Added hook to actually delete a note if requested
Removed old, commented code
Simplified create and delete logic by removing unnecessary checks that make no sense to me now
Cleaned up output from create event
This commit is contained in:
Jon-William Lewis
2015-09-19 18:40:43 -05:00
committed by Jon-William Lewis
parent 337a1bf3a3
commit 35094aed04
5 changed files with 28 additions and 78 deletions

View File

@@ -1,31 +1,5 @@
#function create(){
#
# #Check if note exists
# if [ -e "$NOTE" -o -e ${NOTE%.*} ]; then
# echo ""
# echo "ERROR: Note already exists"
# echo "Hint: use -e to edit the note."
# echo ""
# exit
# else
# #Create any necessary folders
# mkdir -p $NOTEDIR
#
# #Fill in title
# echo "TITLE: $NAME" > $NOTE
# #Fill the second line with the date
# echo "DATE: $(date)" >> $NOTE
#
# if [ "$ENCRYPTION" == "TRUE" ]; then
# if [ "$EDIT" == "FALSE" ]; then
# echo " openssl enc -aes-256-cbc -salt -in $NOTE -out $NOTE.enc -pass pass:$ENC_KEY"
# fi
# fi
# fi
#}
function create(){
if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
if [ -e "$NOTE" ]; then
printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n"
exit
else
@@ -40,5 +14,9 @@ function create(){
p_header | openssl enc -aes-256-cbc -salt -out "$NOTE"\
-pass pass:"$ENC_KEY"
fi
echo "$NOTE"
if [ -e "$NOTE" ]; then
echo "Created note: $NOTEBOOK/$SECTION/$NAME."
fi
}

View File

@@ -1,17 +1,13 @@
function delete(){
if [ "$DELETE" == "TRUE" ]; then
if [ -e "$NOTE" ] || [ -e "${NOTE%.*}" ]; then
if [ "$ENCRYPTION" == "TRUE" ]; then
rm "${NOTE%.*}"
else
rm "$NOTE"
fi
if [ -e "$NOTE" ]; then
rm "$NOTE"
echo ""
echo "Deleted note: $NOTEBOOK/$SECTION$NAME."
echo "Deleted note: $NOTEBOOK/$SECTION/$NAME."
exit
else
echo ""
echo "ERROR: Note $NOTEBOOK/$SECTION$NAME does not exist."
echo "ERROR: Note $NOTEBOOK/$SECTION/$NAME does not exist."
exit
fi
fi