Skip to content

Commit 6c996de

Browse files
committed
scripts: add function for opening (i.e. URLs)
1 parent 1f8b986 commit 6c996de

File tree

2 files changed

+18
-14
lines changed

2 files changed

+18
-14
lines changed

scripts/functions.sh

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,23 @@ prompt_user() {
2222

2323

2424
run_sed() {
25-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
26-
sed --in-place=.bak "$1" "$2"
27-
elif [[ "$OSTYPE" == "darwin"* ]]; then
28-
sed -i .bak "$1" "$2"
29-
else
30-
printf "\nOS could not be detected. Please open report manually!\n"
31-
fi
25+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
26+
sed --in-place=.bak "$1" "$2"
27+
elif [[ "$OSTYPE" == "darwin"* ]]; then
28+
sed -i .bak "$1" "$2"
29+
else
30+
printf "\nOS could not be detected. Please open report manually!\n"
31+
fi
32+
}
33+
34+
run_open() {
35+
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
36+
xdg-open "$1"
37+
elif [[ "$OSTYPE" == "darwin"* ]]; then
38+
open "$1"
39+
else
40+
printf "\nOS could not be detected. Please open URL manually!\n"
41+
fi
3242
}
3343

3444
# Example usage

scripts/release.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,4 @@ echo "✅ created new github release and tag for version: $NEW_VERSION"
111111

112112
JENKINS_URL="https://jenkins.heigit.org/job/OQAPI/view/tags/job/${NEW_VERSION}/"
113113
echo "⚠️ Please start the Jenkins tag build here: ${JENKINS_URL}"
114-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
115-
xdg-open "$JENKINS_URL"
116-
elif [[ "$OSTYPE" == "darwin"* ]]; then
117-
open "$JENKINS_URL"
118-
else
119-
printf "\nOS could not be detected. Please open report manually!\n"
120-
fi
114+
run_open "$JENKINS_URL"

0 commit comments

Comments
 (0)