You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
1.1 KiB
36 lines
1.1 KiB
# 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" |
|
|
|
## shorts |
|
alias nn="nnote" |
|
alias tt="ttodo" |
|
alias nnu="nnote_pull"
|
|
|