44 lines
1.1 KiB
Bash
Executable file
44 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
# ======== CONFIGURATION ========
|
|
CERU_USE_NIX3=true
|
|
# ======== CONFIGURATION ========
|
|
|
|
# libceru env vars
|
|
THIS=$(basename "$0")
|
|
source libceru.sh
|
|
|
|
USAGE="${BOLD}${UNDERLINE}${RED}Usage${RESET}
|
|
${BOLD}${GREEN}$THIS [option...] subcommand${RESET}
|
|
|
|
${BOLD}${UNDERLINE}${RED}Options${RESET}
|
|
${BOLD}${MAGENTA}-h, --help${RESET} Show this message (^_^)
|
|
|
|
${BOLD}${UNDERLINE}${RED}Subcommands${RESET}
|
|
${BOLD}${CYAN}deploy${RESET} Deploy your Cerulean network
|
|
${BOLD}${CYAN}new${RESET} Init new instances of various components (see ${BOLD}${GREEN}\`$THIS new --help\`${RESET})"
|
|
|
|
# parse all args
|
|
SUBCMD=false # whether a subcommand was specified
|
|
while [[ $# -gt 0 ]]; do
|
|
ARG=$1
|
|
case $ARG in
|
|
-h|--help)
|
|
throw-usage 0 ;;
|
|
-*)
|
|
echo "[!] Unknown option \"$ARG\""
|
|
exit 1 ;;
|
|
*)
|
|
SUBCMD=true
|
|
break ;;
|
|
esac
|
|
done; unset -v ARG
|
|
|
|
# invalid usage occurs if no args or subcommand given
|
|
if [[ $# = 0 || "$SUBCMD" = false ]]; then
|
|
throw-usage 1
|
|
fi; unset -v SUBCMD
|
|
|
|
# run provided subcommand
|
|
run-subcmd "$@"
|