| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 44fd9dc commit 3de3dc0
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,52 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + | ||
| 3 | + select_remote () { | ||
| 4 | + remotes=$(git remote) | ||
| 5 | + if [ $(echo $remotes | wc -w) -gt 1 ]; then | ||
| 6 | + for r in $remotes; do | ||
| 7 | + [ $r != origin ] || remote=$r | ||
| 8 | + u=$(git remote get-url $r) | ||
| 9 | + echo "$r, url: $u" | ||
| 10 | + done | ||
| 11 | + [ -n "$remote" ] || remote=$r | ||
| 12 | + read -p "Please select a remote [$remote]: " read_remote | ||
| 13 | + for r in $remotes; do | ||
| 14 | + [ $r != "$read_remote" ] || remote=$read_remote | ||
| 15 | + done | ||
| 16 | + else | ||
| 17 | + remote=$remotes | ||
| 18 | + fi | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + instance_name() { | ||
| 22 | + host=$1 | ||
| 23 | + grep -B 5 "^\s*url\s*=\s*http\(s\)*://$host" ~/.python-gitlab.cfg | grep "^\[" | tail -n 1 | sed -e 's#\[\(.\+\)\]#\1#' | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + if [ "x$1" = "x--git-remote" ]; then | ||
| 27 | + remote=$2 | ||
| 28 | + shift 2 | ||
| 29 | + fi | ||
| 30 | + [ -n "$remote" ] || remote=$(git remote) | ||
| 31 | + if [ -z "$remote" ]; then | ||
| 32 | + echo "No remotes found in repository" | ||
| 33 | + exit 1 | ||
| 34 | + fi | ||
| 35 | + if [ $(echo $remote | wc -w) -gt 1 ]; then | ||
| 36 | + echo "Multiple remotes found, specify a remote using --git-remote REMOTE" | ||
| 37 | + exit 1 | ||
| 38 | + fi | ||
| 39 | + | ||
| 40 | + url=$(git remote get-url $remote) | ||
| 41 | + host=$(echo $url | sed -e 's#^\(git\@\|[a-z]\+://\)\([^:/]\+\)[:/].*#\2#') | ||
| 42 | + instance=$(instance_name $host) | ||
| 43 | + if [ -z "$instance" ]; then | ||
| 44 | + echo "No instance found for $host in ~/python-gitlab.cfg" | ||
| 45 | + exit 1 | ||
| 46 | + fi | ||
| 47 | + | ||
| 48 | + proj=$(echo $url | sed -e 's#.*:\(.*\)$#\1#') | ||
| 49 | + proj=$(echo $proj | sed -e 's#\.git$##') | ||
| 50 | + projid=$proj | ||
| 51 | + | ||
| 52 | + gitlab -g $instance $* --project-id $projid | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,20 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + | ||
| 3 | + # TODO: | ||
| 4 | + # check args for cfg file | ||
| 5 | + # set as git cmd | ||
| 6 | + if [ "x$1" = "x--git-remote" ]; then | ||
| 7 | + git_repo="$1 $2" | ||
| 8 | + shift 2 | ||
| 9 | + fi | ||
| 10 | + # last pipeline: | ||
| 11 | + pipeid=$(gitlab_wrapper.sh $git_repo project-pipeline list | head -n 1 | cut -d: -f2) | ||
| 12 | + gitlab_wrapper.sh $git_repo -o yaml -f id,status,web_url project-pipeline get --id $pipeid | ||
| 13 | + | ||
| 14 | + gitlab_wrapper.sh $git_repo -o yaml -f id,name,status,web_url project-pipeline-job list --pipeline-id $pipeid | ||
| 15 | + | ||
| 16 | + #projurl=$(echo $url | sed "s#:\($proj\)#/\\1#") | ||
| 17 | + #projurl=$(echo $projurl | sed 's#git@#https://#') | ||
| 18 | + #projurl=$(echo $projurl | sed -e 's#\.git$##') | ||
| 19 | + #joburl="$projurl/-/jobs/" | ||
| 20 | + #echo $joburl | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments