zsh: todo() now has automatic push powers
This commit is contained in:
parent
84799e257c
commit
9a47de5f8e
1 changed files with 6 additions and 1 deletions
7
.zshrc
7
.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
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue