summaryrefslogtreecommitdiff
path: root/bin/common/gt-cmd
blob: 66efd50cce9ce27558edd534d9075e8431b47fc5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# path to repo
repo="$1"
# git command
command="$2"
[ "$#" -lt 2 ] && exit 1

repo_pretty="$(printf '%s' "$repo" | sed "s@^$HOME@~@")"

if [ ! -d "$repo" ]; then
	printf '%s missing\n' "$repo_pretty"
	exit 1
fi

git -C "$repo" "$command" >/dev/null 2>&1
[ $? -gt 0 ] && s="x" || s="o"
printf '%s: %s\n' "$repo_pretty" "$s"