From 1bfa77ba96ee020307f7ea7419bcc49001377dbd Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Mon, 9 May 2022 13:40:12 -0700 Subject: [PATCH] Add install go swagger script --- go/.local/bin/install-go-swagger | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 go/.local/bin/install-go-swagger diff --git a/go/.local/bin/install-go-swagger b/go/.local/bin/install-go-swagger new file mode 100755 index 0000000..e45a690 --- /dev/null +++ b/go/.local/bin/install-go-swagger @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -e + +# shellcheck disable=SC1090 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +APP=swagger +VERSION=${VERSION:-0.29.0} +DEST=${XDG_DATA_HOME}/apps/releases/go-swagger +URL=https://github.com/go-swagger/go-swagger/releases/download/v${VERSION}/swagger_$(get_os)_$(get_arch) + +mkdir_if_missing "${DEST}/${VERSION}" +if [[ ! -f "${DEST}/${VERSION}/${APP}" ]]; then + curl --silent --location --output "${DEST}/${VERSION}/${APP}" "${URL}" + chmod +x "${DEST}/${VERSION}/${APP}" +fi +set_current_link "${DEST}" "${VERSION}" +set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}"