summaryrefslogtreecommitdiff
path: root/bin/common/gt-cmd
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-01 16:07:29 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-07-01 16:07:29 +0200
commit30a898e1040ec91cea1ceeb2180bdcf7265f2407 (patch)
tree027b532b59f44afc2d6bbb598f9f7998cb97f764 /bin/common/gt-cmd
parent9d91de38af90ee1d4033666d10613eb03f3d747f (diff)
checkpoint
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"