| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 75fe957 commit e23a0bd
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,6 +1,6 @@ | |||
| 1 | 1 | #!/bin/sh | |
| 2 | 2 | ||
| 3 | - PYGLAB_CONF=~/.python-gitlab.cfg | ||
| 3 | + DFLT_PYGLAB_CONF=~/.python-gitlab.cfg | ||
| 4 | 4 | ||
| 5 | 5 | select_remote () { | |
| 6 | 6 | remotes=$(git remote) | |
@@ -22,7 +22,8 @@ select_remote () { | |||
| 22 | 22 | ||
| 23 | 23 | instance_name() { | |
| 24 | 24 | host=$1 | |
| 25 | - grep -B 5 "^\s*url\s*=\s*http\(s\)*://$host" $PYGLAB_CONF | grep "^\[" | tail -n 1 | sed -e 's#\[\(.\+\)\]#\1#' | ||
| 25 | + pyglab_conf=$2 | ||
| 26 | + grep -B 5 "^\s*url\s*=\s*http\(s\)*://$host" $pyglab_conf | grep "^\[" | tail -n 1 | sed -e 's#\[\(.\+\)\]#\1#' | ||
| 26 | 27 | } | |
| 27 | 28 | ||
| 28 | 29 | remote=$(git config gitlab.remote) | |
@@ -31,6 +32,26 @@ if [ "x$1" = "x--remote" ]; then | |||
| 31 | 32 | remote=$2 | |
| 32 | 33 | shift 2 | |
| 33 | 34 | fi | |
| 35 | + | ||
| 36 | + pyglab_conf=$DFLT_PYGLAB_CONF | ||
| 37 | + pre_cmd_args="" | ||
| 38 | + while echo $1 | grep -q "^-" ; do | ||
| 39 | + case $1 in | ||
| 40 | + -g|--gitlab|-o|--output|-f|--fields) | ||
| 41 | + pre_cmd_args="$pre_cmd_args $1 $2" | ||
| 42 | + shift 2 | ||
| 43 | + ;; | ||
| 44 | + -c|--config-file) | ||
| 45 | + pyglab_conf=$2 | ||
| 46 | + pre_cmd_args="$pre_cmd_args $1 $2" | ||
| 47 | + shift 2 | ||
| 48 | + ;; | ||
| 49 | + *) | ||
| 50 | + pre_cmd_args="$pre_cmd_args $1" | ||
| 51 | + shift 1 | ||
| 52 | + ;; | ||
| 53 | + esac | ||
| 54 | + done | ||
| 34 | 55 | if [ -z "$remote" ]; then | |
| 35 | 56 | echo "No remotes found in repository" | |
| 36 | 57 | exit 1 | |
@@ -46,14 +67,14 @@ fi | |||
| 46 | 67 | ||
| 47 | 68 | url=$(git remote get-url $remote) | |
| 48 | 69 | host=$(echo $url | sed -e 's#^\(git\@\|[a-z]\+://\)\([^:/]\+\)[:/].*#\2#') | |
| 49 | - instance=$(instance_name $host) | ||
| 70 | + instance=$(instance_name $host $pyglab_conf) | ||
| 50 | 71 | if [ -z "$instance" ]; then | |
| 51 | - echo "No instance found for $host in $PYGLAB_CONF" | ||
| 72 | + echo "No instance found for $host in $pyglab_conf" | ||
| 52 | 73 | exit 1 | |
| 53 | 74 | fi | |
| 54 | 75 | ||
| 55 | 76 | proj=$(echo $url | sed -e 's#.*:\(.*\)$#\1#') | |
| 56 | 77 | proj=$(echo $proj | sed -e 's#\.git$##') | |
| 57 | 78 | projid=$proj | |
| 58 | 79 | ||
| 59 | - gitlab -g $instance $* --project-id $projid | ||
| 80 | + gitlab -g $instance $pre_cmd_args $* --project-id $projid | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments