Make things pretty

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
This commit is contained in:
2022-03-11 18:38:32 +00:00
parent b9647b569d
commit 381adefe87
18 changed files with 161 additions and 63 deletions

View File

@@ -1,21 +1,27 @@
#!/usr/bin/env bash
source .utils
DEBUG=""
SUPPORTED_APPS="alertmanager argocd grafana happa kibana kyverno prometheus"
SUPPORTED_APPS="alertmanager cloudprovider grafana happa kibana kyverno prometheus"
print_usage() {
echo "gs-open - open apps on Giant Swarm clusters"
orange "gs-open - open apps on Giant Swarm clusters"
echo " "
underline "Usage:"
echo "gs-open [APP] [INSTALLATION] [WORKLOAD CLUSTER] "
echo " "
echo "Examples:"
underline "Supported apps:"
italic "${SUPPORTED_APPS}"
echo " "
underline "Examples:"
echo "> gs-open prometheus gauss"
echo "> gs-open alertmanager gauss mywc1"
echo " "
echo "Options:"
underline "Options:"
echo "-h, --help show this help text"
echo "--debug show debug log output"
echo " --debug show debug log output"
}
POS_ARGS=()
@@ -48,17 +54,25 @@ if [ ${#POS_ARGS[@]} -eq 1 ]; then
POS_ARGS+=(`opsctl list installations --short | tr ' ' '\n' | fzf`)
fi
APP=${POS_ARGS[0]}
if [[ "${APP}" == "cloud" ]]; then
APP=cloudprovider
fi
if [[ "${APP}" == "prom" ]]; then
APP=prometheus
fi
case ${#POS_ARGS[@]} in
0)
print_usage
exit 1
;;
2)
echo "✨ Opening ${POS_ARGS[0]} on ${POS_ARGS[1]}"
opsctl open ${DEBUG} --app ${POS_ARGS[0]} --installation ${POS_ARGS[1]}
echo "✨ Opening ${APP} on ${POS_ARGS[1]}"
opsctl open ${DEBUG} --app ${APP} --installation ${POS_ARGS[1]}
;;
3)
echo "✨ Opening ${POS_ARGS[0]} on ${POS_ARGS[1]}/${POS_ARGS[2]}"
opsctl open ${DEBUG} --app ${POS_ARGS[0]} --installation ${POS_ARGS[1]} --workload-cluster ${POS_ARGS[2]}
echo "✨ Opening ${APP} on ${POS_ARGS[1]} / ${POS_ARGS[2]}"
opsctl open ${DEBUG} --app ${APP} --installation ${POS_ARGS[1]} --workload-cluster ${POS_ARGS[2]}
;;
esac