zsh: made todo() more logical, committing and pushing after each edit
This commit is contained in:
parent
bd67d14fb2
commit
b942b31f2a
1 changed files with 11 additions and 7 deletions
16
.zshrc
16
.zshrc
|
@ -162,7 +162,6 @@
|
|||
# a simple way to manage your todo list
|
||||
# Usage:
|
||||
# todo -- pull latest repo version and edit ~/todo
|
||||
# todo auto -- commit and push ~/todo with message 'todo'
|
||||
# todo [any git command] -- manage todo for easy syncing, assuming ~/todo is
|
||||
# a symlink that points to a file in a git repo
|
||||
#
|
||||
|
@ -174,11 +173,16 @@
|
|||
todo_dir="$(dirname "$(realpath ~/todo)")"
|
||||
if [ -z "$@" ];then
|
||||
cd "$(dirname "$(realpath ~/todo)")"
|
||||
git rev-parse && git pull
|
||||
$EDITOR ~/todo
|
||||
elif [ "$@" = 'auto' ];then
|
||||
cd "$todo_dir"
|
||||
git commit "$(realpath ~/todo)" -m 'todo'
|
||||
|
||||
# pull the latest commits
|
||||
git rev-parse &&
|
||||
git pull
|
||||
|
||||
"$EDITOR" ~/todo
|
||||
|
||||
# commit and push the file if it's in a git repo
|
||||
git rev-parse &&
|
||||
git commit "$(realpath ~/todo)" -m 'todo' &&
|
||||
git push
|
||||
else
|
||||
cd "$todo_dir"
|
||||
|
|
Loading…
Add table
Reference in a new issue