#!/usr/bin/env bash # Copyright (C) 2023 Umorpha Systems # SPDX-License-Identifier: AGPL-3.0-or-later usage() { cat <&2 '%s: error: unexpected positional arguments: %s' "${*@Q}" arg_mode=error fi if [[ -z "$arg_name" ]]; then printf >&2 '%s: error: --name=HOSTNAME is required\n' "${0##*/}" arg_mode=error fi if [[ -z "$arg_plan" ]]; then printf >&2 '%s: error: --plan=PLAN_ID is required\n' "${0##*/}" arg_mode=error fi if [[ -z "$arg_region" ]]; then printf >&2 '%s: error: --region=REGION_ID is required\n' "${0##*/}" arg_mode=error fi case "$arg_mode" in error) printf >&2 "Try '%q --help' for more information\n" "${0##*/}"; exit 2;; help) show_help;; run) run "$arg_name" "$arg_plan" "$arg_region";; esac fi } main "$@"