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

koopa::activate_bash_aliases() { # {{{1
    # """
    # Alias definitions.
    # @note Updated 2020-06-19.
    # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    # """
    local user_aliases
    koopa::assert_has_no_args "$#"
    user_aliases="${HOME}/.bash_aliases"
    if [[ -f "$user_aliases" ]]
    then
        # shellcheck source=/dev/null
        . "$user_aliases"
    fi
    return 0
}

koopa::activate_bash_completion() { # {{{1
    # """
    # Activate Bash completion.
    # @note Updated 2020-07-06.
    # Add tab completion for many commands.
    # """
    local brew_prefix nounset script
    koopa::assert_has_no_args "$#"
    if koopa::is_installed brew
    then
        brew_prefix="$(koopa::homebrew_prefix)"
        # Ensure existing Homebrew v1 completions continue to work.
        export BASH_COMPLETION_COMPAT_DIR="${brew_prefix}/etc/bash_completion.d"
        # shellcheck source=/dev/null
        script="${brew_prefix}/etc/profile.d/bash_completion.sh"
    else
        script='/etc/bash_completion'
    fi
    [[ -r "$script" ]] || return 0
    nounset="$(koopa::boolean_nounset)"
    if [[ "$nounset" -eq 1 ]]
    then
        set +e
        set +u
    fi
    # shellcheck source=/dev/null
    . "$script"
    if [[ "$nounset" -eq 1 ]]
    then
        set -e
        set -u
    fi
    return 0
}

koopa::activate_bash_extras() { # {{{1
    # """
    # Activate Bash extras.
    # @note Updated 2020-06-19.
    # """
    koopa::assert_has_no_args "$#"
    koopa::activate_bash_completion
    koopa::activate_bash_readline
    koopa::activate_bash_lesspipe
    koopa::activate_bash_aliases
    koopa::activate_bash_prompt
    return 0
}

koopa::activate_bash_lesspipe() { # {{{1
    # """
    # Activate lesspipe for Bash.
    # @note Updated 2020-06-19.
    # Make less more friendly for non-text input files, see lesspipe(1).
    # """
    koopa::assert_has_no_args "$#"
    [[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
    return 0
}

koopa::activate_bash_prompt() { # {{{1
    # """
    # Activate Bash prompt.
    # @note Updated 2020-07-07.
    # """
    koopa::assert_has_no_args "$#"
    PS1="$(koopa::prompt)"
    export PS1
    return 0
}

koopa::activate_bash_readline() { # {{{1
    # """
    # Readline input options.
    # @note Updated 2020-06-19.<commit_msg>Add support for starship prompt<commit_after>#!/usr/bin/env bash

koopa::activate_bash_aliases() { # {{{1
    # """
    # Alias definitions.
    # @note Updated 2020-06-19.
    # See /usr/share/doc/bash-doc/examples in the bash-doc package.
    # """
    local user_aliases
    koopa::assert_has_no_args "$#"
    user_aliases="${HOME}/.bash_aliases"
    if [[ -f "$user_aliases" ]]
    then
        # shellcheck source=/dev/null
        . "$user_aliases"
    fi
    return 0
}

koopa::activate_bash_completion() { # {{{1
    # """
    # Activate Bash completion.
    # @note Updated 2020-07-06.
    # Add tab completion for many commands.
    # """
    local brew_prefix nounset script
    koopa::assert_has_no_args "$#"
    if koopa::is_installed brew
    then
        brew_prefix="$(koopa::homebrew_prefix)"
        # Ensure existing Homebrew v1 completions continue to work.
        export BASH_COMPLETION_COMPAT_DIR="${brew_prefix}/etc/bash_completion.d"
        # shellcheck source=/dev/null
        script="${brew_prefix}/etc/profile.d/bash_completion.sh"
    else
        script='/etc/bash_completion'
    fi
    [[ -r "$script" ]] || return 0
    nounset="$(koopa::boolean_nounset)"
    if [[ "$nounset" -eq 1 ]]
    then
        set +e
        set +u
    fi
    # shellcheck source=/dev/null
    . "$script"
    if [[ "$nounset" -eq 1 ]]
    then
        set -e
        set -u
    fi
    return 0
}

koopa::activate_bash_extras() { # {{{1
    # """
    # Activate Bash extras.
    # @note Updated 2020-06-19.
    # """
    koopa::assert_has_no_args "$#"
    koopa::activate_bash_completion
    koopa::activate_bash_readline
    koopa::activate_bash_lesspipe
    koopa::activate_bash_aliases
    koopa::activate_bash_prompt
    return 0
}

koopa::activate_bash_lesspipe() { # {{{1
    # """
    # Activate lesspipe for Bash.
    # @note Updated 2020-06-19.
    # Make less more friendly for non-text input files, see lesspipe(1).
    # """
    koopa::assert_has_no_args "$#"
    [[ -x /usr/bin/lesspipe ]] && eval "$(SHELL=/bin/sh lesspipe)"
    return 0
}

koopa::activate_bash_prompt() { # {{{1
    # """
    # Activate Bash prompt.
    # @note Updated 2020-11-10.
    # """
    koopa::assert_has_no_args "$#"
    if koopa::is_installed starship
    then
        koopa::activate_starship
        return 0
    fi
    PS1="$(koopa::prompt)"
    export PS1
    return 0
}

koopa::activate_bash_readline() { # {{{1
    # """
    # Readline input options.
    # @note Updated 2020-06-19.
{'fraction_non_alphanumeric': 0.1435032894736842, 'fraction_numerical': 0.02734375, 'mean_word_length': 2.527918781725888, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2964527', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1686, 'n_words': 339}