aboutsummaryrefslogblamecommitdiffstats
path: root/po
blob: a2ac3a8ca4a905966ac0c781095c84d25f2f1b99 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
         

        

                                                              


           

                               

                                

                                             


                                
                                                        
  
 





















                                                             
#!/bin/sh
set -eux

if [ ! -d .osc ] && [ ! -d .git ] ; then
    echo 'This program must be run from an project directory.'
    exit 42
fi

o_url=""
if [ -f .osc/_packages ] ; then
    apiurl=$(cat .osc/_apiurl)
    project=$(cat .osc/_project)
    o_url="${apiurl}/project/show/${project}"
elif [ -f .osc/_package ] ; then
    apiurl=$(cat .osc/_apiurl)
    project=$(cat .osc/_project)
    package=$(cat .osc/_package)
    o_url="${apiurl}/package/show/${project}/${package}"
fi

if [ -z "$o_url" ] ; then
    pr_url="$(gh-which-pr)" || true
    if [ -n "$pr_url" ] ; then
        o_url="$pr_url"
    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)"
        elif git remote show origin >/dev/null 2>&1 ; then
            o_url="$(git remote get-url origin)"
        else
            exit 0
        fi
     fi
fi

[ -z "$o_url" ] || xdg-open "$o_url" >/dev/null 2>&1