ctl.sh 576 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/usr/bin/env bash
  2. set -e
  3. function_to_run=$1
  4. export PROJECT_ROOT
  5. export GORELEASER_VERSION=1.10.2
  6. PROJECT_ROOT=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)
  7. function _includes_path {
  8. echo "$PROJECT_ROOT"/scripts
  9. }
  10. function _load_includes {
  11. for file in "$(_includes_path)"/*.bash; do
  12. # shellcheck disable=1090
  13. source "$file"
  14. done
  15. }
  16. _load_includes
  17. if [[ $(type -t "$function_to_run") != function ]]; then
  18. echo "Subcommand: '$function_to_run' not found."
  19. exit 1
  20. fi
  21. shift
  22. pushd "$PROJECT_ROOT" || _panic
  23. "$function_to_run" "$@"
  24. popd || _panic