<commit_before>#!/usr/bin/env bash
##  ------------------------------------------------------------------------  ##
##                      f.sh:   Commonly Used Functions                       ##
##  ------------------------------------------------------------------------  ##

##  Consists of:
##      log
##      info
##      warn
##      error
##      fatal
##      splash

##      Delay

##      loadEnv
##      saveEnv

##  ------------------------------------------------------------------------  ##
##                                    LOGGERS                                 ##
##  ------------------------------------------------------------------------  ##

function log () {
    printf "[$FUNCNAME][$(date +'%Y%m%d%H%M%S')]\t%s\n" "$@";
}


function info () {
    echo -en "\n${BBlue}[$FUNCNAME]: ${NC}\t" "${@}";
}


function warn () {
    echo -en "\n${BYellow}[$FUNCNAME]:${NC}\t" "${@}";
}


function error () {
    echo -en "\n${BRed}[$FUNCNAME]:${NC}\t" "${@}" "\n" 1>&2;
}


function fatal () {
    echo -e "\n";
    echo -ne "****************** $FUNCNAME *************************"
    echo -ne "%s\n" "$@"
    echo -ne "****************** $FUNCNAME *************************"
    RETVAL=1
}


function splash () {
    echo -ne "\n";
    echo -ne "****************** === *************************\n"
    echo -ne "${BBlue}[$FUNCNAME]${NC}:\t" "${@}" "\n";
    echo -ne "****************** === *************************\n"
}

##  ------------------------------------------------------------------------  ##
##                             Timeout Helper                                 ##
##  ------------------------------------------------------------------------  ##

function Delay () {
    local T=1;
    printf "\nTimeout ${T} second(s) ... ";
    sleep 1;
    printf "DONE\n";
    return 0;
}

##  ------------------------------------------------------------------------  ##
##              Load Environment Variables From .env Files                    ##
##  ------------------------------------------------------------------------  ##

function loadEnv () {

    local ENVD=$1
    ENVD=${ENVD:-.}
    ENV_LIST=$(ls ${ENVD}/.env.*)
    echo -ne "\n${BWhite}ENV: ENV_LIST = [${ENV_LIST}]${NC}";

    if [ ! "${ENV_LIST}" == "" ]; then
        for ENVF in ${ENV_LIST};<commit_msg>no message<commit_after>#!/usr/bin/env bash
##  ------------------------------------------------------------------------  ##
##                      f.sh:   Commonly Used Functions                       ##
##  ------------------------------------------------------------------------  ##

##  Consists of:
##      log
##      info
##      warn
##      error
##      fatal
##      splash

##      Delay

##      loadEnv
##      saveEnv

##  ------------------------------------------------------------------------  ##
##                                    LOGGERS                                 ##
##  ------------------------------------------------------------------------  ##

function log () {
    printf "[$FUNCNAME][$(date +'%Y%m%d%H%M%S')]\t%s\n" "$@";
}


function info () {
    echo -en "\n${BBlue}[$FUNCNAME]: ${NC}\t" "${@}";
}


function warn () {
    echo -en "\n${BYellow}[$FUNCNAME]:${NC}\t" "${@}";
}


function error () {
    echo -en "\n${BRed}[$FUNCNAME]:${NC}\t" "${@}" "\n" 1>&2;
}


function fatal () {
    echo -e "\n";
    echo -ne "****************** $FUNCNAME *************************"
    echo -ne "%s\n" "$@"
    echo -ne "****************** $FUNCNAME *************************"
}


function splash () {
    echo -ne "\n";
    echo -ne "****************** === *************************\n"
    echo -ne "${BBlue}[$FUNCNAME]${NC}:\t" "${@}" "\n";
    echo -ne "****************** === *************************\n"
}

##  ------------------------------------------------------------------------  ##
##                             Timeout Helper                                 ##
##  ------------------------------------------------------------------------  ##

function Delay () {
    local T=1;
    printf "\nTimeout ${T} second(s) ... ";
    sleep 1;
    printf "DONE\n";
    exit 0;
}

##  ------------------------------------------------------------------------  ##
##              Load Environment Variables From .env Files                    ##
##  ------------------------------------------------------------------------  ##

function loadEnv () {

    local ENVD=$1
    ENVD=${ENVD:-.}
    ENV_LIST=$(ls ${ENVD}/.env.*)
    echo -ne "\n${BWhite}ENV: ENV_LIST = [${ENV_LIST}]${NC}";

    if [ ! "${ENV_LIST}" == "" ]; then
        for ENVF in ${ENV_LIST};
{'fraction_non_alphanumeric': 0.4780052264808362, 'fraction_numerical': 0.0028310104529616726, 'mean_word_length': 0.9081844619858745, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5742647', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1155, 'n_words': 223}