#!/bin/bash set -e OP_CLI_VERSION="$1" CLI_URL="https://app-updates.agilebits.com/product_history/CLI2" get_latest_cli_version() { conditional_path="/beta/" if [ "$1" == "non_beta" ]; then conditional_path="!/beta/" fi # This long command parses the HTML page at "CLI_URL" and finds the latest CLI version # based on the release channel we're looking for (stable or beta). # # The ideal call (i.e. 'curl https://app-updates.agilebits.com/check/1/0/CLI2/en/2.0.0/Y -s | jq -r .version') # doesn't retrieve the latest CLI version on a channel basis. # If the latest release is stable and we want the latest beta, this command will return the stable still. OP_CLI_VERSION="$(curl -s $CLI_URL | awk -v RS='