Welcome anonymous visitor. If you have a Cordial Account, please login.
Please refer to Downloads documentation for details.
For the latest Treasury CLI, run:
curl -Sfs https://dl.cordial.systems/install | to=/usr/local/bin bash
If ~/.local/bin
is in your PATH
, feel free to remove the to
parameter above.
#!/usr/bin/env bash set -euo pipefail # default to "treasury-cli" binary=${binary:-treasury-cli} # default to "~/.local/bin" to=${to:-~/.local/bin} # default to "latest" version=${version:-latest} if [[ "${binary}" == "treasury-cli" ]]; then cli=treasury else access_token=$(treasury token create | tail -1) cli=${binary} fi # determine "build" function build () { os=$(uname -s | tr '[:upper:]' '[:lower:]') arch=$(uname -m | sed 's/x86_64/amd64/' | sed 's/aarch64/arm64/') case $os-$arch in linux-amd64) echo x86;; linux-arm64) echo arm;; darwin-arm64) echo mac;; *) echo "OS ${os} with architecture ${arch} is not supported"; false;; esac } # downloader build="$(build)" || build repo="https://dl.cordial.systems/${version}/${build}" function download () { echo ":: Downloading ${1} (${version}) for ${build}" if [[ "${binary}" == "treasury-cli" ]]; then curl -Lfs "${repo}/${1}" | tar xz else curl -Lfs -H "Authorization: Bearer ${access_token}" "${repo}/${1}" | tar xz fi } # download CLI cd /tmp download "${binary}" # sanity check ./"${cli}" version # install # echo ":: Ensuring install directory" install -d "${to}" 2>/dev/null || sudo -p ":: Enter password (to create directory \`${to}\`): " install -d "${to}" # echo ":: Installing \`treasury\`" install "${cli}" "${to}" 2>/dev/null || sudo -p ":: Enter password (to install \`treasury\`): " install "${cli}" "${to}" rm "${cli}" echo ":: Successfully installed \`${cli}\` CLI!"