33 lines
1.0 KiB
Plaintext
33 lines
1.0 KiB
Plaintext
|
# 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"
|