From 297f068dc3fbc6f40e314cf9010ab862c3ce17e2 Mon Sep 17 00:00:00 2001 From: PowerUser64 Date: Wed, 15 Sep 2021 21:38:22 -0700 Subject: [PATCH] improvements to todo() --- .zshrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.zshrc b/.zshrc index 20bbaa6..502b299 100644 --- a/.zshrc +++ b/.zshrc @@ -158,9 +158,12 @@ # an improved way to manage the todo list todo() { + ( cd "$(dirname "$(realpath ~/todo)")" - test -d .git || git rev-parse --git-dir > /dev/null 2>&1 && echo 'pulling repository' && git pull + # only pull the repo if there is some argument + [ -z "$1" ] || test -d .git || git rev-parse --git-dir > /dev/null 2>&1 && echo 'pulling repository' && git pull "$EDITOR" ~/todo + ) } # Simple extraction script. Taken from manjaro's .bashrc