<commit_before>#!/bin/bash

load_futility_package() {
  FUTILITY_PACKAGE_ROOT=$(dirname $BASH_SOURCE)

  source $FUTILITY_PACKAGE_ROOT/core.sh

  FUTILITY_PACKAGE_ROOT=$(current_dir)
  FUTILITY_PACKAGE_LIB="$FUTILITY_PACKAGE_ROOT/lib"

  load_futility_bin
  load_futility_lib
}

load_futility_lib() {
  local lib_file
  for lib_file in $(ls "$FUTILITY_PACKAGE_LIB"); do
    source_if_exists "$FUTILITY_PACKAGE_LIB/$lib_file" --log
  done
}

load_futility_bin() {
  add_to_path $FUTILITY_PACKAGE_ROOT/bin
}

load_futility_package<commit_msg>hacking tempfiles for loading lib<commit_after>#!/bin/bash

export FUTILITY_VERSION='0.1.0'

load_futility_package() {
  FUTILITY_PACKAGE_ROOT=$(dirname $BASH_SOURCE)

  FUTILITY_PACKAGE_CORE="$FUTILITY_PACKAGE_ROOT/core.sh"
  source "$FUTILITY_PACKAGE_CORE"

  FUTILITY_PACKAGE_ROOT=$(current_dir)
  FUTILITY_PACKAGE_LIB="$FUTILITY_PACKAGE_ROOT/lib"

  load_futility_bin
  load_futility_lib
}

load_futility_lib() {
  # Yes this tempfile deal is hacky,
  #   but handles files with spaces and other odd things.
  local lib_file_list=$(mktemp)
  ls -1 "$FUTILITY_PACKAGE_LIB" > ${lib_file_list}

  local lib_file
  while read lib_file; do
    source_if_exists "$FUTILITY_PACKAGE_LIB/$lib_file" --log
  done < ${lib_file_list}
  rm ${lib_file_list}
}

load_futility_bin() {
  FUTILITY_PACKAGE_BIN="$FUTILITY_PACKAGE_ROOT/bin"
  add_to_path "$FUTILITY_PACKAGE_BIN"
}

futility_help() {
  format_contents() {
    ls -1F $1 | sed 's/^/    /'
  }

  cat <<HELP_TEXT
futility v${FUTILITY_VERSION}

Paths used by this package:
  FUTILITY_PACKAGE_ROOT : $FUTILITY_PACKAGE_ROOT/
  FUTILITY_PACKAGE_LIB  : $FUTILITY_PACKAGE_LIB/
  FUTILITY_PACKAGE_BIN  : $FUTILITY_PACKAGE_BIN/

Lib contents:
$(format_contents $FUTILITY_PACKAGE_LIB)

Bin contents:
$(format_contents $FUTILITY_PACKAGE_BIN)

HELP_TEXT
}

load_futility_package
{'fraction_non_alphanumeric': 0.09703504043126684, 'fraction_numerical': 0.003234501347708895, 'mean_word_length': 5.749090909090909, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '4780943', 'n_tokens_mistral': 765, 'n_tokens_neox': 747, 'n_words': 114}