diff --git a/.zshrc b/.zshrc index 35014fe..ab8cd2b 100644 --- a/.zshrc +++ b/.zshrc @@ -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 @@ -188,12 +188,17 @@ # commit and push the file if it's in a git repo and the file has changed if git rev-parse && ! git diff --exit-code "$todo_file"; then git commit "$todo_file" -m 'todo' && - git push + git push fi + ) + + elif [ "$@" = "cd" ]; then + cd "$todo_dir" + else git -C "$todo_dir" $@ + fi - ) } # Simple extraction script. Taken from manjaro's .bashrc