<commit_before>#!/bin/bash

set -e

if [ -f /etc/redhat-release ] && which rpm >/dev/null 2>/dev/null && rpm -qf /etc/redhat-release >/dev/null 2>/dev/null ; then
    PLATFORM='el'
    FLAVOR=$(rpm -qf /etc/redhat-release --qf=%{name})
    FLAVOR=${FLAVOR%-*}
    VERSION_MAJ=$(rpm -qf /etc/redhat-release --qf=%{version})
    VERSION_MIN=$(rpm -qf /etc/redhat-release --qf=%{release})
    VERSION_MIN=${VERSION_MIN%.*}
    VERSION="${VERSION_MAJ}.${VERSION_MIN}"
elif which lsb_release >/dev/null 2>/dev/null && lsb_release -i -s | grep -qi ubuntu ; then
    PLATFORM='ubuntu'
    FLAVOR=$(lsb_release -i -s)
    VERSION=$(lsb_release -r -s)
    VERSION_MAJ=${VERSION%.*}
    VERSION_MIN=${VERSION##*.}
else
    PLATFORM='unknown'
fi

__q() {
    default=$1
    shift
    question=$@
    if [ "$default" == "y" -o "$default" == "Y" -o "$default" == "1" ] ; then
        default=1
        prompt="[Y/n]"
    else
        default=0
        prompt="[y/N]"
    fi
    read -e -p "$question $prompt " -N1 -t60 response
    if [ $default -eq 1 ] ; then
        if echo "$response"|grep -qi "n" ; then
            true
            exit # false
        else
            echo y
            exit
        fi
    else
        if echo "$response"|grep -qi "y" ; then
            echo y
            exit
        else
            true
            exit # false
        fi
    fi
}

q_atom_config="$(__q 1 Ship ATOM preconfigured with preferred settings?)"
q_atom_puppet="$(__q 1 Ship ATOM with Puppet packages?)"
q_atom_git="$(__q 1 Ship ATOM with Git packages?)"
q_atom_md="$(__q 1 Ship ATOM with Markdown packages?)"
q_atom_json="$(__q 1 Ship ATOM with JSON packages?)"
q_atom_minimap="$(__q 1 Ship ATOM with Sublime-style Minimap packages?)"<commit_msg>always read answers from tty<commit_after>#!/bin/bash

set -e

exec 3<>/dev/tty

if [ -f /etc/redhat-release ] && which rpm >/dev/null 2>/dev/null && rpm -qf /etc/redhat-release >/dev/null 2>/dev/null ; then
    PLATFORM='el'
    FLAVOR=$(rpm -qf /etc/redhat-release --qf=%{name})
    FLAVOR=${FLAVOR%-*}
    VERSION_MAJ=$(rpm -qf /etc/redhat-release --qf=%{version})
    VERSION_MIN=$(rpm -qf /etc/redhat-release --qf=%{release})
    VERSION_MIN=${VERSION_MIN%.*}
    VERSION="${VERSION_MAJ}.${VERSION_MIN}"
elif which lsb_release >/dev/null 2>/dev/null && lsb_release -i -s | grep -qi ubuntu ; then
    PLATFORM='ubuntu'
    FLAVOR=$(lsb_release -i -s)
    VERSION=$(lsb_release -r -s)
    VERSION_MAJ=${VERSION%.*}
    VERSION_MIN=${VERSION##*.}
else
    PLATFORM='unknown'
fi

__q() {
    default=$1
    shift
    question=$@
    if [ "$default" == "y" -o "$default" == "Y" -o "$default" == "1" ] ; then
        default=1
        prompt="[Y/n]"
    else
        default=0
        prompt="[y/N]"
    fi
    read -u 3 -e -p "$question $prompt " -N1 -t60 response
    if [ $default -eq 1 ] ; then
        if echo "$response"|grep -qi "n" ; then
            true
            exit # false
        else
            echo y
            exit
        fi
    else
        if echo "$response"|grep -qi "y" ; then
            echo y
            exit
        else
            true
            exit # false
        fi
    fi
}

q_atom_config="$(__q 1 Ship ATOM preconfigured with preferred settings?)"
q_atom_puppet="$(__q 1 Ship ATOM with Puppet packages?)"
q_atom_git="$(__q 1 Ship ATOM with Git packages?)"
q_atom_md="$(__q 1 Ship ATOM with Markdown packages?)"
q_atom_json="$(__q 1 Ship ATOM with JSON packages?)"
q_atom_minimap="$(__q 1 Ship ATOM with Sublime-style Minimap packages?)"
{'fraction_non_alphanumeric': 0.1565340909090909, 'fraction_numerical': 0.010227272727272727, 'mean_word_length': 2.3248347497639283, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 16, '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': '455583', 'n_tokens_mistral': 1330, 'n_tokens_neox': 1245, 'n_words': 333}