diff options
author | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-10-28 00:18:29 +0200 |
---|---|---|
committer | Raymaekers Luca <raymaekers.luca@gmail.com> | 2023-10-28 00:18:29 +0200 |
commit | 7c2235af535afadd16b2cdb351e85f3abc237cd4 (patch) | |
tree | 2ab34239cefc6f0a0b48b9973e3548e876d60fce /bin/extra | |
parent | 59b13370e0129bdd313421340c709172bbf3230b (diff) |
added git verb as argument feature
Current format of the supd command
[DIR]: [SUCCES OF COMMAND] [REMOTE STATE]
Diffstat (limited to 'bin/extra')
-rwxr-xr-x | bin/extra/supd | 24 |
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 |