zsh: add todo cd to todo()

This commit is contained in:
PowerUser64 2021-09-26 13:37:33 -07:00
parent bba61c3b31
commit 1ed5ec20e6

9
.zshrc
View file

@ -172,10 +172,10 @@
# a symlink called 'todo' that points to your todo list in your home directory
#
todo() {
( # subshell to protect against directory changes
todo_dir="$(dirname "$(realpath ~/todo)")"
todo_file="$(realpath ~/todo)"
if [ -z "$@" ];then
( # subshell to protect against directory changes
cd "$todo_dir"
# pull the latest commits
@ -190,10 +190,15 @@
git commit "$todo_file" -m 'todo' &&
git push
fi
)
elif [ "$@" = "cd" ]; then
cd "$todo_dir"
else
git -C "$todo_dir" $@
fi
)
}
# Simple extraction script. Taken from manjaro's .bashrc