Files
vns/src/includes/create.sns.sh
Jon-William Lewis 3cb375f64b 2.0a4 -> 2.0a5
Changed some filenames
Rewrote edit function to be more sane
Separated encryption and decryption functions from edit into libencryption.sh
Fixed a bug where an edit tag would be added regardless of create status
2015-05-07 22:11:13 -05:00

45 lines
1.1 KiB
Bash

#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" -o -e ${NOTE%.*} ]; then
printf "\nERROR: Note already exists\nHint: use -e to edit the note.\n"
exit
else
mkdir -p "$NOTEDIR"
fi
if [ -z "$ENCRYPTION" ]; then
echo "TITLE: $NAME" > $NOTE
echo "DATE: $(date)" >> $NOTE
elif [ "$ENCRYPTION" == "TRUE" ]; then
touch "$NOTE"
echo "$(p_header)" | openssl enc -aes-256-cbc -salt -out "$NOTE"\
-pass pass:$ENC_KEY
fi
echo "$NOTE"
}