#!/usr/bin/env bash set -euo pipefail # shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=bws VERSION=${VERSION:-0.3.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} main() ( URL=https://github.com/bitwarden/sdk/releases/download/bws-v${VERSION}/bws-$(uname -m)-$(get_os)-${VERSION}.zip extract_zip "${URL}" "${DEST}/${VERSION}" set_current_link "${DEST}" "${VERSION}" set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" ) function get_os () { case $(uname -s) in Linux*) echo unknown-linux-gnu;; Darwin*) echo apple-darwin;; *) >&2 echo "unsupported os: $(uname -s)"; exit 1;; esac } main "${@}"