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