zsh: made todo() more logical, committing and pushing after each edit

This commit is contained in:
PowerUser64 2021-09-21 21:18:41 -07:00
parent bd67d14fb2
commit b942b31f2a

16
.zshrc
View file

@ -162,7 +162,6 @@
# a simple way to manage your todo list
# Usage:
# todo -- pull latest repo version and edit ~/todo
# todo auto -- commit and push ~/todo with message 'todo'
# todo [any git command] -- manage todo for easy syncing, assuming ~/todo is
# a symlink that points to a file in a git repo
#
@ -174,11 +173,16 @@
todo_dir="$(dirname "$(realpath ~/todo)")"
if [ -z "$@" ];then
cd "$(dirname "$(realpath ~/todo)")"
git rev-parse && git pull
$EDITOR ~/todo
elif [ "$@" = 'auto' ];then
cd "$todo_dir"
git commit "$(realpath ~/todo)" -m 'todo'
# pull the latest commits
git rev-parse &&
git pull
"$EDITOR" ~/todo
# commit and push the file if it's in a git repo
git rev-parse &&
git commit "$(realpath ~/todo)" -m 'todo' &&
git push
else
cd "$todo_dir"