diff options
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/common/gt | 24 | ||||
| -rwxr-xr-x | bin/common/gt-st | 8 | 
2 files changed, 16 insertions, 16 deletions
diff --git a/bin/common/gt b/bin/common/gt index 48321af..477adfc 100755 --- a/bin/common/gt +++ b/bin/common/gt @@ -6,6 +6,7 @@  # - git  # - $EDITOR: -e  # - parallel: optional, if installed will run the commands on all repos with parallel +# - gt-[cmd,st,sync]  repos=$HOME/sync/share/git-track.txt  # prevent file not found errors @@ -36,17 +37,6 @@ fetch() {  	done  } -sync_status() { -	if [ "$parallel" ]; then -		parallel --colsep ' ' gt-sync {1} {2} <"$repos" -	else -		IFS=' ' -		while read -r repo remote_url; do -			gt-sync "$repo" "$remote_url" -		done <"$repos" -	fi -} -  # no options  if [ -z "$1" ]; then  	help @@ -55,7 +45,7 @@ fi  [ "$(wc -l <"$repos")" -gt 0 ] || exit 0 -while getopts ":a:c:f:lsheuy" opt; do +while getopts ":a:c:f:lsheu" opt; do  	case "$opt" in  	a)  		if ! cd "$OPTARG" 2>/dev/null; then @@ -84,12 +74,18 @@ while getopts ":a:c:f:lsheuy" opt; do  			fi  		;;  	s) cut -f 1 -d ' ' "$repos" | xargs -I{} gt-st {} ;; -	y) sync_status ;;  	l) cut -f 1 -d ' ' "$repos" ;;  	e) $EDITOR "$repos" ;;  	f) repos="$OPTARG" ;;  	u) -		sync_status | awk -F ':' '/x$/ {print $1}' | +		if [ "$parallel" ]; then +			parallel --colsep ' ' gt-sync {1} {2} <"$repos" +		else +			IFS=' ' +			while read -r repo remote_url; do +				gt-sync "$repo" "$remote_url" +			done <"$repos" +		fi | awk -F ':' '/x$/ {print $1}' |  			if [ "$parallel" ]; then  				parallel gt-cmd {} pull  			else diff --git a/bin/common/gt-st b/bin/common/gt-st index 98184b9..43443cd 100755 --- a/bin/common/gt-st +++ b/bin/common/gt-st @@ -14,11 +14,15 @@ if [ ! -d "$repo" ]; then  fi  # replace line with status -status="$(git -C "$repo" status  --porcelain 2>/dev/null | +status="$(git -C "$repo" status --porcelain 2>/dev/null |  	awk '{print $1}' |  	sort | uniq | tr -s '?' |  	tr -d '\n')"  remote="$(git -C "$repo" branch -v 2>/dev/null |  	sed '/^*/!d;s/ahead/↑/;s/behind/↓/;s/[^↓↑]*//g')" -printf '%s %s %s\n' "$repo_pretty" "$status" "$remote" +if [ "$status" ] || [ "$remote" ]; then +	printf '%s: \033[0;31m%s %s\033[0m\n' "$repo_pretty" "$status" "$remote" +else +	printf '%s\n' "$repo_pretty" +fi  | 
