# shellcheck shell=sh

main() {
  if shell_is_bash
  then
    load_bash_autocomplete
  fi
}

shell_is_bash() {
  # we don't want to depend on pgrep, it doesn't ship on macOS out of the box as far as I can remember
  # shellcheck disable=SC2009
  ps -p $$ -o comm= | grep -q "bash"
}

load_bash_autocomplete() {
  eval "$(make bash-autocomplete)"
}

main
