repo.sh 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/usr/bin/env bash
  2. # Copyright 2025 Google LLC
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. # USAGE: ./repo.sh <subcommand> [args...]
  16. #
  17. # EXAMPLE: ./repo.sh tests decrypt --json ./scripts/secrets/AI.json
  18. #
  19. # Wraps around the local "repo" swift package, and facilitates calls to it.
  20. # The main purpose of this is to make calling "repo" easier, as you typically
  21. # need to call "swift run" with the package path.
  22. set -euo pipefail
  23. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  24. if [[ $# -eq 0 ]]; then
  25. cat 1>&2 <<EOF
  26. OVERVIEW: Small script for running repo commands.
  27. Repo commands live under the scripts/repo swift package.
  28. USAGE: $0 <subcommand> [args...]
  29. EOF
  30. exit 1
  31. fi
  32. swift run --package-path "${ROOT}/repo" "$@"