<commit_before>#!/bin/bash

function __gvmtool_determine_outdated_version {
    local candidate local_versions remote_default_version
    candidate="$1"

    # Resolve local versions
    local_versions="$(echo $(find "${GVM_DIR}/${candidate}" -maxdepth 1 -mindepth 1 -type d -exec basename '{}' \;) | sed -e "s/ /, /g" )"
    if [ ${#local_versions} -eq 0 ]; then
        return 1
    fi

    # Resolve remote default version
    remote_default_version="$(curl -s "${GVM_SERVICE}/candidates/${candidate}/default")"
    if [ -z "$remote_default_version" ]; then
        return 2
    fi

    # Check outdated or not
    if [ ! -d "${GVM_DIR}/${candidate}/${remote_default_version}" ]; then
        echo "${candidate} (${local_versions} < ${remote_default_version})"
    fi
}

function __gvmtool_outdated {
    local all candidates candidate outdated installed_count outdated_count
    if [ -n "$1" ]; then
        all=false
        candidates=$1
    else
        all=true
        candidates=${GVM_CANDIDATES[@]}
    fi
    installed_count=0
    outdated_count=0
    for candidate in ${candidates}; do
        outdated="$(__gvmtool_determine_outdated_version "${candidate}")"
        case $? in
            1)
                $all || echo "Not using any version of ${candidate}"
                ;;
            2)
                echo ""
                echo "Stop! Could not get remote version of ${candidate}"
                return 1
                ;;
            *)
                if [ -n "${outdated}" ]; then
                    [ ${installed_count} -eq 0 ] && echo "Outdated:"
                    echo "${outdated}"
                    (( outdated_count += 1 ))
                fi
                (( installed_count += 1 ))<commit_msg>Fix the issue that the "Outdated:" label is not displayed in some cases.<commit_after>#!/bin/bash

function __gvmtool_determine_outdated_version {
    local candidate local_versions remote_default_version
    candidate="$1"

    # Resolve local versions
    local_versions="$(echo $(find "${GVM_DIR}/${candidate}" -maxdepth 1 -mindepth 1 -type d -exec basename '{}' \;) | sed -e "s/ /, /g" )"
    if [ ${#local_versions} -eq 0 ]; then
        return 1
    fi

    # Resolve remote default version
    remote_default_version="$(curl -s "${GVM_SERVICE}/candidates/${candidate}/default")"
    if [ -z "$remote_default_version" ]; then
        return 2
    fi

    # Check outdated or not
    if [ ! -d "${GVM_DIR}/${candidate}/${remote_default_version}" ]; then
        echo "${candidate} (${local_versions} < ${remote_default_version})"
    fi
}

function __gvmtool_outdated {
    local all candidates candidate outdated installed_count outdated_count
    if [ -n "$1" ]; then
        all=false
        candidates=$1
    else
        all=true
        candidates=${GVM_CANDIDATES[@]}
    fi
    installed_count=0
    outdated_count=0
    for candidate in ${candidates}; do
        outdated="$(__gvmtool_determine_outdated_version "${candidate}")"
        case $? in
            1)
                $all || echo "Not using any version of ${candidate}"
                ;;
            2)
                echo ""
                echo "Stop! Could not get remote version of ${candidate}"
                return 1
                ;;
            *)
                if [ -n "${outdated}" ]; then
                    [ ${outdated_count} -eq 0 ] && echo "Outdated:"
                    echo "${outdated}"
                    (( outdated_count += 1 ))
                fi
                (( installed_count += 1 ))
{'fraction_non_alphanumeric': 0.12323346523459582, 'fraction_numerical': 0.009044657998869417, 'mean_word_length': 1.978956228956229, 'pattern_counts': {'":': 0, '<': 5, '<?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': '494453', 'n_tokens_mistral': 1058, 'n_tokens_neox': 992, 'n_words': 270}