#!/bin/bash # shellcheck disable=SC2086 # _______._____.__________._________ # \_ (| / ._ \ \ # \ l / |/ / / / # \_______/ /l_____X___\______\ # \_____/ # ▓▓▓▓▓▓▓▓▓▓ # ░▓ author ▓ xero # ░▓ code ▓ https://code.x-e.ro/dotfiles # ░▓ mirror ▓ https://git.io/.files # ░▓▓▓▓▓▓▓▓▓▓ # ░░░░░░░░░░ # dont run as root [[ "$(id -u)" -eq 0 ]] && { echo "just be yourself"; exit 0; } usage() { me="$(basename "$(test -L "$0" && readlink "$0" || echo "$0")")" cat <&2; usage;; (*) break;; esac shift done [[ -z "$host" ]] && usage [[ "$host" =~ ^(q|quit|x|exit|rip|disconnect)$ ]] && disconnect [[ -z "$account" ]] || account="--account ${account}" eval "$(op signin ${account})" echo "getting credentials" user="$(get_user $secret)" login="$(get_login $secret)" connect "$user" "$login" "$host" "$dns" "$protocol" "$cert" } # fail fast w/ proper exit codes set -eo pipefail # run main logic parse_args "$@"