#!/usr/bin/env sh set -eu helmdocsv=1.4.0 bindir=$( cd "${0%/*}" && pwd ) # Change to script dir and set bin dir to this targetbin=$( cd "$bindir"/.. && pwd )/target/bin helmdocsbin=$targetbin/helm-docs-$helmdocsv os="" arch="" if [ ! -f "$helmdocsbin" ]; then case $(uname | tr '[:upper:]' '[:lower:]') in darwin*) os=darwin arch=x86_64 ;; linux*) os=linux case $(uname -m) in x86_64) arch=x86_64 ;; amd64) arch=amd64 ;; arm) tmp=$(dpkg --print-architecture) if echo "$tmp" | grep -q arm64; then arch=arm64 elif echo "$tmp" | grep -q armv7; then arch=armv7 elif echo "$tmp" | grep -q armv6; then arch=armv6 fi ;; esac ;; msys*) os=windows arch=x86_64 ;; esac if [ -z "$os" ]; then echo "Couldn't find a matching binary" exit 126 fi helmdocscurl="https://github.com/norwoodj/helm-docs/releases/download/v$helmdocsv/helm-docs_${helmdocsv}_${os}_${arch}.tar.gz" tmp=$(mktemp -d -t helm-docs.XXX) mkdir -p "$targetbin" ( cd "$tmp" curl -Lsf -o "./helm-docs.tar.gz" "$helmdocscurl" tar zf "./helm-docs.tar.gz" -x "helm-docs" chmod +x "helm-docs" ) mv "$tmp/helm-docs" "$helmdocsbin" fi "$helmdocsbin" "$@"