Created
January 10, 2018 06:46
-
-
Save dj1020/d1032cec9c67aeddde739c17801e6199 to your computer and use it in GitHub Desktop.
Quick open gitlab/git repo page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getRepoUrl() { | |
local name='origin' | |
local gitUrl | |
local repoUrl | |
if [ ! -z "$1" ]; then | |
name="$1" | |
fi | |
gitUrl=`git remote get-url $name` | |
repoUrl=`php -r "echo str_replace([':', 'git@', '.git'], ['/', 'https://', ''], '${gitUrl}'); echo PHP_EOL;"` | |
echo $repoUrl | |
} | |
openGitRepo() { | |
local repoUrl | |
repoUrl=`getRepoUrl $1 $2 $3 $4` | |
echo "Open" $repoUrl | |
open $repoUrl | |
} | |
openGitMrPage() { | |
local repoUrl | |
repoUrl=`getRepoUrl $1 $2 $3 $4` | |
echo "Open" $repoUrl/merge_requests | |
open $repoUrl/merge_requests | |
} | |
openGitTagPage() { | |
local repoUrl | |
repoUrl=`getRepoUrl $1 $2 $3 $4` | |
echo "Open" $repoUrl/tags | |
open $repoUrl/tags | |
} | |
openGitPipelinePage() { | |
local repoUrl | |
repoUrl=`getRepoUrl $1 $2 $3 $4` | |
echo "Open" $repoUrl/pipelines | |
open $repoUrl/pipelines | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment