FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

git-gitlab: Use variable for python gitlab conf file instead of havin… · python-gitlab/python-gitlab@75fe957 · GitHub

Repository navigation

Commit 75fe957

Browse files
committed
git-gitlab: Use variable for python gitlab conf file instead of having it hard coded
1 parent 1504cd4 commit 75fe957

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

‎git-gitlab.sh‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/sh
22

3+
PYGLAB_CONF=~/.python-gitlab.cfg
4+
35
select_remote () {
46
remotes=$(git remote)
57
if [ $(echo $remotes | wc -w) -gt 1 ]; then
@@ -20,7 +22,7 @@ select_remote () {
2022

2123
instance_name() {
2224
host=$1
23-
grep -B 5 "^\s*url\s*=\s*http\(s\)*://$host" ~/.python-gitlab.cfg | grep "^\[" | tail -n 1 | sed -e 's#\[\(.\+\)\]#\1#'
25+
grep -B 5 "^\s*url\s*=\s*http\(s\)*://$host" $PYGLAB_CONF | grep "^\[" | tail -n 1 | sed -e 's#\[\(.\+\)\]#\1#'
2426
}
2527

2628
remote=$(git config gitlab.remote)
@@ -46,7 +48,7 @@ url=$(git remote get-url $remote)
4648
host=$(echo $url | sed -e 's#^\(git\@\|[a-z]\+://\)\([^:/]\+\)[:/].*#\2#')
4749
instance=$(instance_name $host)
4850
if [ -z "$instance" ]; then
49-
echo "No instance found for $host in ~/python-gitlab.cfg"
51+
echo "No instance found for $host in $PYGLAB_CONF"
5052
exit 1
5153
fi
5254

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL