summaryrefslogtreecommitdiff
path: root/bin/common/gt-cmd
diff options
context:
space:
mode:
Diffstat (limited to 'bin/common/gt-cmd')
-rwxr-xr-xbin/common/gt-cmd18
1 files changed, 18 insertions, 0 deletions
diff --git a/bin/common/gt-cmd b/bin/common/gt-cmd
new file mode 100755
index 0000000..66efd50
--- /dev/null
+++ b/bin/common/gt-cmd
@@ -0,0 +1,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"