#!/bin/sh 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}" 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