Skip to content

Commit

Permalink
handle unix grep
Browse files Browse the repository at this point in the history
  • Loading branch information
Savid committed Oct 7, 2024
1 parent 85e1526 commit 19d965e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ fetch_latest_tag() {
info "Fetching the latest release information from GitHub..."
LATEST_RELEASE_JSON=$(curl -s "https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest") || error "Failed to fetch release information."

TAG=$(echo "$LATEST_RELEASE_JSON" | grep -oP '"tag_name":\s*"\K(.*)(?=")') || error "Failed to parse release tag."
if [ "$OS" = "darwin" ]; then
TAG=$(echo "$LATEST_RELEASE_JSON" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p') || error "Failed to parse release tag."
else
TAG=$(echo "$LATEST_RELEASE_JSON" | grep -oP '"tag_name":\s*"\K(.*)(?=")') || error "Failed to parse release tag."
fi
[[ -z "$TAG" ]] && error "Release tag not found."
info "Latest release tag: $TAG"
}
Expand Down

0 comments on commit 19d965e

Please sign in to comment.