diff --git a/.zsh-integration b/.zsh-integration new file mode 100644 index 0000000..025e3d6 --- /dev/null +++ b/.zsh-integration @@ -0,0 +1,32 @@ +# NNotes +# basic CLI notes and todo inventory + +# internal vars +nnote_dir="$HOME/.nnotes" +nnote_local_file="$nnote_dir/$HOST/note.md" +ttodo_local_file="$nnote_dir/$HOST/todo.md" + +# create local folders if does not exist +if [[ ! -d "$nnote_dir/$HOST" ]]; then + mkdir $nnote_dir/$HOST + touch $nnote_local_file + touch $ttodo_local_file +fi + +# internal alias +alias nnote_gitadd="(cd $nnote_dir/ && git add $nnote_local_file && git commit -m \"update by $HOST\" && git push --quiet -u --no-progress)" +alias ttodo_gitadd="(cd $nnote_dir/ && git add $ttodo_local_file && git commit -m \"update by $HOST\" && git push --quiet -u --no-progress)" +alias nnote_pull="(cd $nnote_dir && git pull)" + + +# Print current todos into fresh spawned shell +if [[ ! -z $(grep '[^[:space:]]' $(printf "$nnote_dir" "$@")/$HOST/todo.md) ]]; then + echo '==============| Local ToDos |==============' + echo '' + tail "$nnote_dir/$HOST/todo.md" + echo '' +fi + +# external alias +alias nnote="nano $nnote_local_file && nnote_gitadd" +alias ttodo="nano $ttodo_local_file && ttodo_gitadd"