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
|
# a simple way to manage your todo list
|
||||||
# Usage:
|
# Usage:
|
||||||
# todo -- pull latest repo version and edit ~/todo
|
# 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
|
# todo [any git command] -- 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
|
||||||
#
|
#
|
||||||
|
@ -174,11 +173,16 @@
|
||||||
todo_dir="$(dirname "$(realpath ~/todo)")"
|
todo_dir="$(dirname "$(realpath ~/todo)")"
|
||||||
if [ -z "$@" ];then
|
if [ -z "$@" ];then
|
||||||
cd "$(dirname "$(realpath ~/todo)")"
|
cd "$(dirname "$(realpath ~/todo)")"
|
||||||
git rev-parse && git pull
|
|
||||||
$EDITOR ~/todo
|
# pull the latest commits
|
||||||
elif [ "$@" = 'auto' ];then
|
git rev-parse &&
|
||||||
cd "$todo_dir"
|
git pull
|
||||||
git commit "$(realpath ~/todo)" -m 'todo'
|
|
||||||
|
"$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
|
git push
|
||||||
else
|
else
|
||||||
cd "$todo_dir"
|
cd "$todo_dir"
|
||||||
|
|
Loading…
Add table
Reference in a new issue