summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Steinbeiß <ochosi@xfce.org>2020-12-09 15:37:17 +0100
committerSimon Steinbeiß <ochosi@xfce.org>2020-12-09 15:37:17 +0100
commit7f9fe83263c3ebe13861439e9a5949470004907d (patch)
tree65e2b5b03fcd8e042ec3e4998293cd4250e64696
parent6bd43f8ef09e60ca92ea8a2746469cf1a513e727 (diff)
downloadxfce4-dev-tools-7f9fe83263c3ebe13861439e9a5949470004907d.tar.gz
helpers: Add new helper xfce-open-gitlab
This helper enables you to quickly open the GitLab project of your Git repository in your browser. You can navigate to a subpage by supplying it as an argument (e.g. "issues").
-rwxr-xr-xhelpers/xfce-open-gitlab54
1 files changed, 54 insertions, 0 deletions
diff --git a/helpers/xfce-open-gitlab b/helpers/xfce-open-gitlab
new file mode 100755
index 0000000..2f3c0b3
--- /dev/null
+++ b/helpers/xfce-open-gitlab
@@ -0,0 +1,54 @@
+#!/usr/bin/env bash
+# Small script to open the current projects GitLab page
+# You can supply an argument to get to the respective subpage (e.g. "issues" or "tags")
+
+GITLAB="https://gitlab.xfce.org"
+APPS="xfce4-screensaver
+ xfmpc
+ xfdashboard
+ xfce4-volumed-pulse
+ xfce4-terminal
+ xfce4-taskmanager
+ xfce4-screenshooter
+ xfce4-panel-profiles
+ xfce4-notifyd
+ xfce4-mixer
+ xfce4-dict
+ xfburn
+ ristretto
+ parole
+ mousepad
+ gigolo
+ catfish
+ "
+
+# Check if we're in a git repo and get the name
+is_git=$(git rev-parse --is-inside-work-tree)
+if [ "$is_git" != "true" ]; then
+ exit 1
+else
+ REPO=$(basename `git rev-parse --show-toplevel`)
+fi
+
+# Guess the GitLab group name
+if [[ $APPS == *"$REPO"* ]]; then
+ GROUP="apps"
+elif [[ "$REPO" =~ "thunar-" ]]; then
+ GROUP="thunar-plugins"
+elif [[ "$REPO" =~ "-plugin" ]]; then
+ GROUP="panel-plugins"
+else
+ GROUP="xfce"
+fi
+
+# Use the argument to go to subpages
+if [ -n "$1" ]; then
+ SLUG="-/$1"
+else
+ SLUG=""
+fi
+
+URL="$GITLAB/$GROUP/$REPO/$SLUG"
+
+echo "Opening $URL in your browser..."
+exo-open $URL