Version 2.0

This commit is contained in:
Jan Jastrow 2021-09-02 20:41:21 +02:00
parent 89abcfbe71
commit c61f97a55c
1 changed files with 32 additions and 0 deletions

32
.zsh-integration Normal file
View File

@ -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"