From 9a47de5f8e431d661c9e51520f9b5677ae235f6d Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Thu, 16 Sep 2021 02:16:34 -0700 Subject: [PATCH] zsh: todo() now has automatic push powers --- .zshrc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 430fc25..1a3f4f1 100644 --- a/.zshrc +++ b/.zshrc @@ -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 )