diff options
Diffstat (limited to 'po')
-rwxr-xr-x | po | 29 |
1 files changed, 23 insertions, 6 deletions
@@ -1,16 +1,33 @@ #!/bin/sh -if [ ! -d .osc ] ; then - echo 'This program must be run from an OBS project directory.' +if [ ! -d .osc ] && [ ! -d .git ] ; then + echo 'This program must be run from an project directory.' exit 42 fi -if [ -f .osc/_packages ] ; then +o_url="" +if [ -f .osc/_packages ] ; then apiurl=$(cat .osc/_apiurl) project=$(cat .osc/_project) - xdg-open "${apiurl}/project/show/${project}" -else + o_url="${apiurl}/project/show/${project}" +elif [ -f .osc/_package ] ; then apiurl=$(cat .osc/_apiurl) project=$(cat .osc/_project) package=$(cat .osc/_package) - xdg-open "${apiurl}/package/show/${project}/${package}" + o_url="${apiurl}/package/show/${project}/${package}" +elif [ -d .git ] ; then + if git remote show gitlab >/dev/null 2>&1 ; then + o_url="$(git remote get-url gitlab)" + elif git remote show github >/dev/null 2>&1 ; then + o_url="$(git remote get-url github)" + elif git remote show sourcehut >/dev/null 2>&1 ; then + o_url="$(git remote get-url sourcehut)" + elif git remote show myrepo >/dev/null 2>&1 ; then + o_url="$(git remote get-url myrepo)" + else + exit 0 + fi +else + exit 0 fi + +xdg-open "$o_url" >/dev/null 2>&1 |