Add docopts arm64 version for macOS

This commit is contained in:
T. R. Bernstein
2024-07-02 04:21:33 +02:00
committed by T. R. Bernstein
parent 139501de16
commit 9ec150ba10
2 changed files with 7 additions and 16 deletions

View File

@@ -97,7 +97,9 @@ function ensureCommandLineTools() {
function ensureDocopts() { function ensureDocopts() {
which docopts > /dev/null && return which docopts > /dev/null && return
local fileURL="${DOCOPTS_URL:-https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64}" local defaultURL="https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64"
[[ $(uname -m) == arm64 ]] && defaultURL="https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_arm64"
local fileURL="${DOCOPTS_URL:-${defaultURL}}"
curl --output ./docopts -fsSL "${fileURL}" || return curl --output ./docopts -fsSL "${fileURL}" || return
chmod u+x ./docopts chmod u+x ./docopts
PATH="${PATH}:`pwd`" PATH="${PATH}:`pwd`"

View File

@@ -17,7 +17,9 @@ function copyUtilityBinaries() {
function installDocopts() { function installDocopts() {
local destPath='/usr/local/bin/docopts' local destPath='/usr/local/bin/docopts'
[[ -x ${destPath} ]] && return [[ -x ${destPath} ]] && return
indicateActivity -- 'Downloading docpts' curl --output ${destPath} -fsSL ${docopts_url} || return local docoptsURL="https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64"
[[ $(uname -m) == arm64 ]] && docoptsURL="https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_arm64"
indicateActivity -- 'Downloading docpts' curl --output ${destPath} -fsSL ${docoptsURL} || return
ensureRightAccess ${destPath} ensureRightAccess ${destPath}
} }
@@ -40,28 +42,15 @@ function getExecPrerequisites() {
) )
} }
function getDefaultDocoptsURL() {
local fileURL="${DOCOPTS_URL:-https://github.com/astzweig/docopts/releases/download/v.0.7.0/docopts_darwin_amd64}"
print -- ${fileURL}
}
function getQuestions() {
questions=(
'i: docopts-url=From which URL shall the docopts binary be downloaded? # default:'"$(getDefaultDocoptsURL)"
)
}
function getUsage() { function getUsage() {
read -r -d '' text <<- USAGE read -r -d '' text <<- USAGE
Usage: Usage:
$cmdName show-questions [<modkey> <modans>]... $cmdName show-questions [<modkey> <modans>]...
$cmdName [-v] [-d FILE] --docopts-url URL $cmdName [-v] [-d FILE]
Install convenient binaries for all users. Install convenient binaries for all users.
Options: Options:
--docopts-url URL The URL from which to download the docopts binary
[default: $(getDefaultDocoptsURL)].
-d FILE, --logfile FILE Print log message to logfile instead of stdout. -d FILE, --logfile FILE Print log message to logfile instead of stdout.
-v, --verbose Be more verbose. -v, --verbose Be more verbose.
---- ----