by aedocw · 4y ago · 0 comments
note () {
DATE=`date +"%Y%m%d"`
TS=`date +"%Y%m%d %H:%M:%S"`
FILE=$HOME/Documents/notes/$DATE.txt
notegitpull
echo $TS >> $FILE
vi $FILE
notegitpush
}
notegitpull () {
pushd $HOME/Documents/notes
if ping -c 1 git.server &> /dev/null
then
git pull
else
echo "Offline, not pulling changes"
fi
popd
}
notegitpush () {
pushd $HOME/Documents/notes
git pull
git add \*
git commit -m "Autocommit due to edit of $FILE"
if ping -c 1 git.server &> /dev/null
then
git push origin main
else
echo "Offline, not pushing changes up"
fi
popd
}note //Adds a note to the current days notefile, in the current directory's .notes folder if present or ~/.notes if not
edit-note //Opens the same notefile as above in a text editor
notes //Concats todays notefiles echos displays them
all-notes //Concats all notes ever and echos them, useful to grep for keywords across my history of notes