<commit_before>#!/bin/bash

dir=$1; shift
if [[ "${dir}X" == "X" || ! -d ${dir} ]]; then
  echo "USAGE: envdir.sh path/to/env/dir"
  exit 1
fi

rm -rf $dir/*

wal_env_var_prefixes=(WAL AWS SWIFT WABS)
for prefix in ${wal_env_var_prefixes[@]}; do
  for env in $(env | grep "^${prefix}"); do
    env_var=($(echo $env | tr "=" "\n"))
    echo ${env_var[1]} > $dir/${env_var[0]}
  done
done

echo env director files:
ls $dir/*<commit_msg>nice message if no wal-e env vars to be passed to wal-e<commit_after>#!/bin/bash

dir=$1; shift
if [[ "${dir}X" == "X" || ! -d ${dir} ]]; then
  echo "USAGE: envdir.sh path/to/env/dir"
  exit 1
fi

rm -rf $dir/*

wal_env_var_prefixes=(WAL AWS SWIFT WABS)
for prefix in ${wal_env_var_prefixes[@]}; do
  for env in $(env | grep "^${prefix}"); do
    env_var=($(echo $env | tr "=" "\n"))
    echo ${env_var[1]} > $dir/${env_var[0]}
  done
done

wal_env_var_count=$(ls $dir/* | wc -l | awk '{print $1}')

# test for empty dir comes from http://stackoverflow.com/a/91639
if find $dir/ -maxdepth 0 -empty | read v; then
  echo "No wal-e env vars"
else
  ls $dir/*
fi
{'fraction_non_alphanumeric': 0.20109689213893966, 'fraction_numerical': 0.013711151736745886, 'mean_word_length': 3.5625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '410705', 'n_tokens_mistral': 468, 'n_tokens_neox': 455, 'n_words': 136}