diff --git a/scripts/functions.sh b/scripts/functions.sh index 3d30401ca..9d548dd7f 100644 --- a/scripts/functions.sh +++ b/scripts/functions.sh @@ -22,13 +22,23 @@ prompt_user() { run_sed() { -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - sed --in-place=.bak "$1" "$2" -elif [[ "$OSTYPE" == "darwin"* ]]; then - sed -i .bak "$1" "$2" -else - printf "\nOS could not be detected. Please open report manually!\n" -fi + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + sed --in-place=.bak "$1" "$2" + elif [[ "$OSTYPE" == "darwin"* ]]; then + sed -i .bak "$1" "$2" + else + printf "\nOS could not be detected. Please open report manually!\n" + fi +} + +run_open() { + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + xdg-open "$1" + elif [[ "$OSTYPE" == "darwin"* ]]; then + open "$1" + else + printf "\nOS could not be detected. Please open URL manually!\n" + fi } # Example usage diff --git a/scripts/release.sh b/scripts/release.sh index 96fa259fb..1a4b7f028 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -111,10 +111,4 @@ echo "✅ created new github release and tag for version: $NEW_VERSION" JENKINS_URL="https://jenkins.heigit.org/job/OQAPI/view/tags/job/${NEW_VERSION}/" echo "⚠️ Please start the Jenkins tag build here: ${JENKINS_URL}" -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - xdg-open "$JENKINS_URL" -elif [[ "$OSTYPE" == "darwin"* ]]; then - open "$JENKINS_URL" -else - printf "\nOS could not be detected. Please open report manually!\n" -fi +run_open "$JENKINS_URL"