summaryrefslogtreecommitdiff
path: root/bin/extra
diff options
context:
space:
mode:
Diffstat (limited to 'bin/extra')
-rwxr-xr-xbin/extra/supd24
1 files changed, 10 insertions, 14 deletions
diff --git a/bin/extra/supd b/bin/extra/supd
index 36027ad..48638bd 100755
--- a/bin/extra/supd
+++ b/bin/extra/supd
@@ -1,9 +1,5 @@
#!/bin/sh
-# To add?
-# - possibility of changing verb pull/fetch/push
-# - adding prefix
-
ls() { find . -mindepth 1 -maxdepth 1 -type d -not -name ".*" -printf '%f\n'; }
if [ "$1" = '-h' ]
@@ -21,16 +17,16 @@ fi
for dir in $dirs
do
- printf '%s: ' "$dir" | >&2 sed "s#$HOME#~#"
+ printf '%s:' "$dir" | >&2 sed "s#$HOME#~#"
(
- cd "$dir" || exit
- git pull > /dev/null 2>&1 &&
- printf 'Up to date.' ||
- printf 'Couldn'\''t update.'
- # Show remote state
- printf ' %s %s\n' "$(git status --short 2> /dev/null |
- awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null |
- awk -F '[][]' '/^\*/ {print $2}')" |
- sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g'
+ cd "$dir" || return
+ git "${1:-fetch}" > /dev/null 2>&1 &&
+ printf ' o' ||
+ printf ' x'
+ # Show remote state
+ printf '%s %s\n' "$(git status --short 2> /dev/null |
+ awk 'NR==1 {print $1}')" "$(git branch -v 2>/dev/null |
+ awk -F '[][]' '/^\*/ {print $2}')" |
+ sed 's/ahead/↑ /;s/behind/↓ /;s/[^↓↑]*/ /g'
)
done