<commit_before>source "${SANDBIN_HOME}/scripts/lib/git-functions.lib.zsh"

function usage-init() {
    local mode="$1"

    [ "$mode" = "help" ] && printf "${CYAN}Initialize a new git repository (git & git flow)${NORMAL}\n"
    printf "usage: ${BOLD}gitbox init${NORMAL} [init | setup | changelog | ranking] [-h, --help]\n"

    if [ "$mode" = "help" ]; then
        printf "\nOptions:\n"
        printf "    ${BOLD}-f, --force${NORMAL}     Force to initialize git flow\n"
        printf "    ${BOLD}-s, --server${NORMAL}    Initialize a git bare shared repository\n"
        printf "    ${BOLD}-h, --help${NORMAL}      Display this help\n"
    fi
}

function gitbox-init() {

    while [[ $# > 0 ]]; do
        key="$1"

        case $key in
            -f|--force)
                force=$key
            ;;
            -s|--server)
                if is_a_git_workspace; then
                    printf "${RED}gitbox init: The '%s' directory is already a git repository!${NORMAL}\n" $(pwd)
                    exit 1
                fi
                printf "Initializing git bare shared repository in '%s' directory...\n" $(pwd)
                git init --bare --shared
                exit $?
            ;;
            -h|--help)
                usage-init "help"
                exit 0
            ;;
            *)
                printf "${RED}Ouch! Unknown option '%s'. Please try agan!${NORMAL}\n" "$key"
                usage-init
                exit 1
            ;;
        esac

        shift;
    done

    if is_a_git_workspace; then
        printf "${YELLOW}The '%s' directory is already a git repository!${NORMAL}\n" $(pwd)
        git_flow_init $force

    else
        git init
        git_flow_init $force
    fi

    exit $?
}
<commit_msg>Fix 'gitbox init' error messages<commit_after>source "${SANDBIN_HOME}/scripts/lib/git-functions.lib.zsh"

function usage-init() {
    local mode="$1"

    [ "$mode" = "help" ] && printf "${CYAN}Initialize a new git repository (git & git flow)${NORMAL}\n"
    printf "usage: ${BOLD}gitbox init${NORMAL} [init | setup | changelog | ranking] [-h, --help]\n"

    if [ "$mode" = "help" ]; then
        printf "\nOptions:\n"
        printf "    ${BOLD}-f, --force${NORMAL}     Force to initialize git flow\n"
        printf "    ${BOLD}-s, --server${NORMAL}    Initialize a git bare shared repository\n"
        printf "    ${BOLD}-h, --help${NORMAL}      Display this help\n"
    fi
}

function gitbox-init() {

    while [[ $# > 0 ]]; do
        key="$1"

        case $key in
            -f|--force)
                force=$key
            ;;
            -s|--server)
                if is_a_git_workspace; then
                    printf "${RED}gitbox init: The '%s' directory is already a git repository!${NORMAL}\n" $(pwd)
                    exit 1
                fi
                printf "Initializing git bare shared repository in '%s' directory...\n" $(pwd)
                git init --bare --shared
                exit $?
            ;;
            -h|--help)
                usage-init "help"
                exit 0
            ;;
            *)
                printf "${RED}gitbox init: Ouch! Unknown option '%s'. Please try agan!${NORMAL}\n" "$key"
                usage-init
                exit 1
            ;;
        esac

        shift;
    done

    if is_a_git_workspace; then
        printf "${YELLOW}The '%s' directory is already a git repository!${NORMAL}\n" $(pwd)
        git_flow_init $force

    else
        git init
        git_flow_init $force
    fi

    exit $?
}

{'fraction_non_alphanumeric': 0.13799887577290612, 'fraction_numerical': 0.003372681281618887, 'mean_word_length': 1.5081042988019733, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '650775', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1049, 'n_words': 294}