#!/usr/bin/env bash

set -euo pipefail

root="$(git rev-parse --show-toplevel)"

export PATH=$root/.devfiles/bin:$root/.devfiles/scripts:$PATH

devtools=(
  age
  agebox
  cog
  gitleaks
)

missing_tools=()

for cmd in "${devtools[@]}"; do
  if ! command -v "$cmd" &>/dev/null; then
    missing_tools+=("$cmd")
  fi
done

if [[ ${#missing_tools[@]} != 0 ]]; then
  echo "The following tools where not found:"
  printf "%s\n" "${missing_tools[@]}"
  exit 1
else
  echo -e "All tools are installed!"
fi
