#!/usr/bin/env sh

echo "$@" >> /tmp/xcode-select-$$.log

# We could not care less, luckily this always comes first
if [[ ${1} == --sdk || ${1} == -sdk ]]; then
  shift;
  shift;
elif [[ ${1} == -version ]]; then
  # If Qt uses this to determine C++ features then we need to
  # pretend to be a very recent Xcode.
  echo "Xcode 10.0.0" >> /tmp/xcode-select-$$.log
  echo "Build version 8E3004b" >> /tmp/xcode-select-$$.log
  echo "Xcode 10.0.0"
  echo "Build version 8E3004b"
  exit 0
fi

case ${1} in

  -version)
    shift
    ;;

  [-]-print-path)
    echo $(dirname ${CC})
    ;;

  [-]-install)
    echo "ERROR :: conda ecosystem fake xcode-select cannot install anything, use conda"
    ;;

  -s)
    shift
    ;;

esac
