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
|
# an improved way to manage the todo list
|
||||||
# Usage:
|
# Usage:
|
||||||
# todo -- edit ~/todo
|
# todo -- edit ~/todo
|
||||||
|
# todo auto -- commit ~/todo and push with message 'todo'
|
||||||
# todo [git command string] -- manage todo for easy syncing, assuming ~/todo is
|
# todo [git command string] -- manage todo for easy syncing, assuming ~/todo is
|
||||||
# a symlink that points to a file in a git repo
|
# a symlink that points to a file in a git repo
|
||||||
todo() {
|
todo() {
|
||||||
( # subshell to protect against directory changes
|
( # subshell to protect against directory changes
|
||||||
|
todo_dir="$(dirname "$(realpath ~/todo)")"
|
||||||
if [ -z "$@" ];then
|
if [ -z "$@" ];then
|
||||||
cd "$(dirname "$(realpath ~/todo)")"
|
cd "$(dirname "$(realpath ~/todo)")"
|
||||||
$EDITOR ~/todo
|
$EDITOR ~/todo
|
||||||
|
elif [ "$@" = 'auto' ];then
|
||||||
|
cd "$todo_dir"
|
||||||
|
git commit "$(realpath ~/todo)" -m 'todo' && todo push
|
||||||
else
|
else
|
||||||
cd "$(dirname "$(realpath ~/todo)")"
|
cd "$todo_dir"
|
||||||
git $@
|
git $@
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue