#!/usr/bin/env bash

# Starts a project using the appropriate Docker Compose or Nix Flake command.

set -euo pipefail

if [[ -f flake.nix ]]; then
  nix develop -c "$SHELL"
  exit 0
fi

if [[ -f docker-compose.yml ]]; then
  docker compose up -d "${@}"
  exit 0
fi

if [[ -f docker-compose.yaml ]]; then
  docker compose up -d "${@}"
  exit 0
fi

echo "No docker-compose.yaml or flake.nix file found."
exit 1