improved todo()
This commit is contained in:
parent
a8b6b58964
commit
c2e6e88e27
1 changed files with 7 additions and 5 deletions
10
.zshrc
10
.zshrc
|
@ -158,11 +158,13 @@
|
||||||
|
|
||||||
# an improved way to manage the todo list
|
# an improved way to manage the todo list
|
||||||
todo() {
|
todo() {
|
||||||
(
|
( # subshell to protect against directory changes
|
||||||
|
if [ -z "$@" ];then
|
||||||
|
$EDITOR ~/todo
|
||||||
|
else
|
||||||
cd "$(dirname "$(realpath ~/todo)")"
|
cd "$(dirname "$(realpath ~/todo)")"
|
||||||
# only pull the repo if there is some argument
|
git $@
|
||||||
[ -z "$1" ] || test -d .git || git rev-parse --git-dir > /dev/null 2>&1 && echo 'pulling repository' && git pull
|
fi
|
||||||
"$EDITOR" ~/todo
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue