<commit_before>#!/usr/bin/env bash

load_env() {
  local env=${1:?no env set}
  shift

  # Fuzzy filtering that removes the trailing .env if you do specify it
  if [[ ${env} =~ .*.env$ ]]; then
    local env="${env%'.env'}"
  fi

  if [ -r ${HOME}/.env/${env}.env ]; then
    . ${HOME}/.env/${env}.env
    echo "Loading ENV: ${env}"
    export LOAD_ENV="${env} ${LOAD_ENV}"<commit_msg>check for textfile while loading env<commit_after>#!/usr/bin/env bash

load_env() {
  local env=${1:?no env set}
  shift

  # Fuzzy filtering that removes the trailing .env if you do specify it
  if [[ ${env} =~ .*.env$ ]]; then
    local env="${env%'.env'}"
  fi

  if [ -r ${HOME}/.env/${env}.env ]; then
    if [ $(file -b --mime-type ${HOME}/.env/${env}.env) != "text/plain" ]; then
      echo "Could not load ENV: ${env}. Not a text file"
      return 1
    else
      . ${HOME}/.env/${env}.env
      echo "Loading ENV: ${env}"
      export LOAD_ENV="${env} ${LOAD_ENV}"
    fi
{'fraction_non_alphanumeric': 0.2047569803516029, 'fraction_numerical': 0.0031023784901758012, 'mean_word_length': 2.751937984496124, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4456693', 'n_tokens_mistral': 361, 'n_tokens_neox': 349, 'n_words': 103}