<commit_before>#!/bin/sh

# General global variable exports.
# Updated 2019-08-14.



# Standard globals                                                          {{{1
# ==============================================================================

# This variables are used by some koopa scripts, so ensure they're always
# consistently exported across platforms.

# HOSTNAME
if [ -z "${HOSTNAME:-}" ]
then
    HOSTNAME="$(uname -n)"
    export HOSTNAME
fi

# OSTYPE
# Automatically set by bash and zsh.
# Updated 2019-06-26.
if [ -z "${OSTYPE:-}" ]
then
    OSTYPE="$(uname -s | tr '[:upper:]' '[:lower:]')"
    export OSTYPE
fi

# TERM
# Terminal color mode. This should normally be set by the terminal client.
if [ -z "${TERM:-}" ]
then
    export TERM="screen-256color"
fi

# TODAY
# Current date. Alternatively, can use `%F` shorthand.
if [ -z "${TODAY:-}" ]
then
    TODAY="$(date +%Y-%m-%d)"
    export TODAY
fi

# USER
if [ -z "${USER:-}" ]
then
    USER="$(whoami)"
    export USER
fi



# Interface                                                                 {{{1
# ==============================================================================

# Trim the maximum number of directories in prompt (PS1).
# For bash, requires >= v4.
[ -z "${PROMPT_DIRTRIM:-}" ] && export PROMPT_DIRTRIM=4



# History                                                                   {{{1
# ==============================================================================

[ -z "${HISTFILE:-}" ] && 
    HISTFILE="${HOME}/."$(_koopa_shell)"-history" &&
    export HISTFILE

[ -z "${HISTSIZE:-}" ] && export HISTSIZE=100000
[ -z "${SAVEHIST:-}" ] && export SAVEHIST=100000

[ -z "${HISTCONTROL:-}" ] && 
    export HISTCONTROL="ignoredups"
[ -z "${HISTIGNORE:-}" ] && 
    export HISTIGNORE="&:ls:[bf]g:exit"

# Add the date/time to `history` command output.
# Note that on macOS bash will fail if `set -e` is set and this isn't exported.
[ -z "${HISTTIMEFORMAT:-}" ] && 
    export HISTTIMEFORMAT="%Y%m%d %T  "

[ -z "${PROMPT_COMMAND:-}" ] && 
    export PROMPT_COMMAND="history -a"



# Locale / encoding                                                         {{{1
# ==============================================================================

# Force UTF-8 to avoid encoding issues for users with broken locale settings.<commit_msg>Improve if/then consistency<commit_after>#!/bin/sh

# General global variable exports.
# Updated 2019-08-14.



# Standard globals                                                          {{{1
# ==============================================================================

# This variables are used by some koopa scripts, so ensure they're always
# consistently exported across platforms.

# HOSTNAME
if [ -z "${HOSTNAME:-}" ]
then
    HOSTNAME="$(uname -n)"
    export HOSTNAME
fi

# OSTYPE
# Automatically set by bash and zsh.
# Updated 2019-06-26.
if [ -z "${OSTYPE:-}" ]
then
    OSTYPE="$(uname -s | tr '[:upper:]' '[:lower:]')"
    export OSTYPE
fi

# TERM
# Terminal color mode. This should normally be set by the terminal client.
if [ -z "${TERM:-}" ]
then
    export TERM="screen-256color"
fi

# TODAY
# Current date. Alternatively, can use `%F` shorthand.
if [ -z "${TODAY:-}" ]
then
    TODAY="$(date +%Y-%m-%d)"
    export TODAY
fi

# USER
if [ -z "${USER:-}" ]
then
    USER="$(whoami)"
    export USER
fi



# Interface                                                                 {{{1
# ==============================================================================

# Trim the maximum number of directories in prompt (PS1).
# For bash, requires >= v4.
if [ -z "${PROMPT_DIRTRIM:-}" ]
then
    export PROMPT_DIRTRIM=4
fi



# History                                                                   {{{1
# ==============================================================================

if [ -z "${HISTFILE:-}" ]
then
    HISTFILE="${HOME}/.$(_koopa_shell)-history"
    export HISTFILE
fi

if [ -z "${HISTSIZE:-}" ]
then
    export HISTSIZE=100000
fi

if [ -z "${SAVEHIST:-}" ]
then
    export SAVEHIST=100000
fi

if [ -z "${HISTCONTROL:-}" ]
then
    export HISTCONTROL="ignoredups"
fi

if [ -z "${HISTIGNORE:-}" ]
then
    export HISTIGNORE="&:ls:[bf]g:exit"
fi

# Add the date/time to `history` command output.
# Note that on macOS bash will fail if `set -e` is set and this isn't exported.
if [ -z "${HISTTIMEFORMAT:-}" ]
then
    export HISTTIMEFORMAT="%Y%m%d %T  "
fi

if [ -z "${PROMPT_COMMAND:-}" ]
then
    export PROMPT_COMMAND="history -a"
fi



# Locale / encoding                                                         {{{1
# ==============================================================================

# Force UTF-8 to avoid encoding issues for users with broken locale settings.
{'fraction_non_alphanumeric': 0.2619949494949495, 'fraction_numerical': 0.016414141414141416, 'mean_word_length': 2.5523168908819134, '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': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1193041', 'n_tokens_mistral': 1508, 'n_tokens_neox': 1326, 'n_words': 411}