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

echo -n "Looking for curl... "
which curl > /dev/null || echo "not "
echo "found."

echo -n "Looking for less... "
which less > /dev/null || echo -n "not "
echo "found."

echo -n "Does \$HOME/bin exists?... "
ls $HOME/bin > /dev/null 2>&1
if [ $? -ne 0 ]; then
    echo "no."
    
    echo -n "Creating \$HOME/bin... "
    mkdir $HOME/bin && echo "done" || echo "fail!"

    echo -n "Adding it to the \$PATH... "
    echo "export PATH=\$PATH:\$HOME/bin" >> $HOME/.bashrc
    echo "done."

else
    echo "yes."
fi

echo -n "Downloading rfc... "
curl -fs https://raw.github.com/bfontaine/rfc/master/rfc > "$HOME/bin/rfc" \
    && echo "done." || echo "fail!"

echo -n "Making it executable... "
chmod u+x "$HOME/bin/rfc" && echo "done." || echo "fail!"<commit_msg>Install script improved.<commit_after>#! /usr/bin/env bash

function __install_rfc() {

printf "Looking for curl... "
which curl > /dev/null
if [ "$?" = "0" ]; then
    echo "found."
else
    printf "not found. I'll try with wget... "
    which wget > /dev/null
    if [ "$?" -eq 0 ]; then
        echo "found."
    else
        echo 'not found!'
        return 1
    fi
fi

printf "Looking for less... "
which less > /dev/null
if [ "$?" = "0" ]; then
    echo "found"
else
    if [ -n "$PAGER" ]; then
        echo "not found. I'll use '$PAGER' instead."
    else
        echo 'not found!'
        return 1
    fi
fi

printf "Does \$HOME/bin exists?... "
if [ ! -d "$HOME/bin" ]; then
    echo "no."
    
    printf "Creating \$HOME/bin... "
    mkdir $HOME/bin 2>/dev/null && echo "done." || echo 'fail!'
else
    echo "yes."
fi

echo ":$PATH:" | grep -q ":$HOME/bin:"
if [ "$?" != "0" ]; then
    printf "Adding it to the \$PATH... "
    echo "\n# Added by 'rfc' installer\nexport PATH=\$PATH:\$HOME/bin" \
        >> $HOME/.bash_profile \
            && echo "done." || echo 'fail!'
fi

printf "Downloading rfc... "
curl -fs https://raw.github.com/bfontaine/rfc/master/rfc > "$HOME/bin/rfc" \
    && echo "done." || echo 'fail!'

printf "Making it executable... "
chmod u+x "$HOME/bin/rfc" && echo "done." || echo 'fail!'

}
__install_rfc;
{'fraction_non_alphanumeric': 0.20028011204481794, 'fraction_numerical': 0.004668534080298786, 'mean_word_length': 2.2322775263951735, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '441473', 'n_tokens_mistral': 816, 'n_tokens_neox': 775, 'n_words': 243}