zsh: todo() now has automatic push powers

This commit is contained in:
PowerUser64 2021-09-16 02:16:34 -07:00
parent 063db819b4
commit 67c70c5bb8

7
.zshrc
View file

@ -159,15 +159,20 @@
# an improved way to manage the todo list
# Usage:
# todo -- edit ~/todo
# todo auto -- commit ~/todo and push with message 'todo'
# todo [git command string] -- manage todo for easy syncing, assuming ~/todo is
# a symlink that points to a file in a git repo
todo() {
( # subshell to protect against directory changes
todo_dir="$(dirname "$(realpath ~/todo)")"
if [ -z "$@" ];then
cd "$(dirname "$(realpath ~/todo)")"
$EDITOR ~/todo
elif [ "$@" = 'auto' ];then
cd "$todo_dir"
git commit "$(realpath ~/todo)" -m 'todo' && todo push
else
cd "$(dirname "$(realpath ~/todo)")"
cd "$todo_dir"
git $@
fi
)