diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-12 18:47:33 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-07-12 18:47:33 +0200 |
commit | 0b7195aab3e729f2b577545b3485dfe1193fd046 (patch) | |
tree | 5dd97a7fb50bb3fc05c34a5d1db31d824b3738e9 | |
parent | 36004c35c0e1ee4abcdcce70c923ab8410360f61 (diff) |
updated sgd function
-rw-r--r-- | config/essentials/zsh/functions.zsh | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/config/essentials/zsh/functions.zsh b/config/essentials/zsh/functions.zsh index 5c4d609..487c247 100644 --- a/config/essentials/zsh/functions.zsh +++ b/config/essentials/zsh/functions.zsh @@ -111,18 +111,19 @@ upfile () { sgd () { d="$PWD" - for dir in ${1:-$HOME/src/*} - do - cd $dir + find $HOME/src -maxdepth 1 -mindepth 1 -type d | + while read -r dir + do + cd "$dir" + git status > /dev/null 2>&1 || continue git fetch > /dev/null 2>&1 - if [ "$(git status --short 2>/dev/null | grep -v "??" | head -1)" ] - then - # There are changes, and this is a git repo - echo "$PWD \e[1;31m*changes\e[0m" - fi + printf "$PWD" + test "$(git status --short 2>/dev/null | grep -v "??" | head -1)" && + printf " \e[1;31m*changes\e[0m" | sed "s#$HOME#~#" >&2 test "$(parse_git_remote)" && - echo "$PWD \e[0;32m*push/pull\e[0m" - done + printf " \e[0;32m*push/pull\e[0m" | sed "s#$HOME#~#" >&2 + printf "\n" + done cd "$d" unset d } |