#!/bin/sh [ -n "${DEBUG-}" ] && set -x cd "$(dirname "$0")" || exit 1 newest_wezterm_release() { curl -s -H "Accept: application/vnd.github+json" -L https://api.github.com/repos/wez/wezterm/releases/latest | jq -r '.assets | map(select(.name | startswith("WezTerm-macos"))) | first.browser_download_url' } LATEST_WEZTERM=$(newest_wezterm_release) install_latest_wezterm() { curl -Lo wezterm.zip "$LATEST_WEZTERM" ouch d wezterm.zip rm -rf /Applications/WezTerm.app mv WezTerm-macos-*/WezTerm.app /Applications/ && rm -rf wezterm.zip WezTerm-macos-* } if [ ! -e /Applications/WezTerm.app ]; then install_latest_wezterm else current_wezterm=$(/Applications/WezTerm.app/Contents/MacOS/wezterm -V | awk '{print $2}') if ! echo "$LATEST_WEZTERM" | grep "$current_wezterm" >/dev/null; then install_latest_wezterm fi fi