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

koopa::_pkg_config_version() { # {{{1
    # """
    # Get a library version via pkg-config.
    # @note Updated 2021-03-01.
    # """
    local pkg x
    koopa::assert_has_args_eq "$#" 1
    pkg="${1:?}"
    koopa::is_installed pkg-config || return 1
    x="$(pkg-config --modversion "$pkg")"
    [[ -n "$x" ]] || return 1
    koopa::print "$x"
    return 0

}

koopa::anaconda_version() { # {{{
    # """
    # Anaconda verison.
    # @note Updated 2020-07-08.
    # """
    local x
    koopa::assert_has_no_args "$#"
    koopa::is_anaconda || return 1
    koopa::assert_is_installed awk grep
    x="$( \
        conda list 'anaconda' \
            | grep -E '^anaconda ' \
            | awk '{print $2}' \
    )"
    koopa::print "$x"
    return 0
}

koopa::armadillo_version() { # {{{1
    # """
    # Armadillo: C++ library for linear algebra & scientific computing.
    # @note Updated 2021-03-01.
    # """
    koopa::assert_has_no_args "$#"
    koopa::_pkg_config_version 'armadillo'
}

koopa::boost_version() { # {{{1
    # """
    # Boost (libboost) version.
    # @note Updated 2021-03-01.
    # """
    koopa::assert_has_no_args "$#"
    koopa::_pkg_config_version 'boost'
}

koopa::cairo_version() { # {{{1
    # """
    # Cairo (libcairo) version.
    # @note Updated 2021-03-01.
    # """
    koopa::assert_has_no_args "$#"
    koopa::_pkg_config_version 'cairo'
}

koopa::current_bcbio_version() { # {{{1
    # """
    # Get the latest bcbio-nextgen stable release version.
    # @note Updated 2020-06-30.
    #
    # This approach checks for latest stable release available via bioconda.
    # """
    local url x
    koopa::assert_has_no_args "$#"
    koopa::assert_is_installed curl<commit_msg>Add support for Boost version extraction<commit_after>#!/usr/bin/env bash

koopa::_pkg_config_version() { # {{{1
    # """
    # Get a library version via pkg-config.
    # @note Updated 2021-03-01.
    # """
    local pkg x
    koopa::assert_has_args_eq "$#" 1
    pkg="${1:?}"
    koopa::is_installed pkg-config || return 1
    x="$(pkg-config --modversion "$pkg")"
    [[ -n "$x" ]] || return 1
    koopa::print "$x"
    return 0

}

koopa::anaconda_version() { # {{{
    # """
    # Anaconda verison.
    # @note Updated 2020-07-08.
    # """
    local x
    koopa::assert_has_no_args "$#"
    koopa::is_anaconda || return 1
    koopa::assert_is_installed awk grep
    x="$( \
        conda list 'anaconda' \
            | grep -E '^anaconda ' \
            | awk '{print $2}' \
    )"
    koopa::print "$x"
    return 0
}

koopa::armadillo_version() { # {{{1
    # """
    # Armadillo: C++ library for linear algebra & scientific computing.
    # @note Updated 2021-03-01.
    # """
    koopa::assert_has_no_args "$#"
    koopa::_pkg_config_version 'armadillo'
}

koopa::boost_version() { # {{{1
    # """
    # Boost (libboost) version.
    # @note Updated 2021-03-02.
    # @seealso
    # - https://stackoverflow.com/questions/3708706/
    # - https://stackoverflow.com/questions/4518584/
    # """
    local major minor patch x
    koopa::assert_has_no_args "$#"
    koopa::assert_is_installed bc gcc grep
    # Extract the Boost library version using GCC preprocessing. This approach
    # is nice because it doesn't hardcode to a specific file path.
    x="$( \
        koopa::print '#include <boost/version.hpp>\nBOOST_VERSION' \
        | gcc -x c++ -E - \
        | grep -E '^[0-9]+$' \
    )"
    [[ -n "$x" ]] || return 1
    # Convert '107500' to '1.75.0', for example.
    major="$(koopa::print "$x / 100000" | bc)"
    minor="$(koopa::print "$x / 100 % 1000" | bc)"
    patch="$(koopa::print "$x % 100" | bc)"
    koopa::print "${major}.${minor}.${patch}"
    return 0
}

koopa::cairo_version() { # {{{1
    # """
    # Cairo (libcairo) version.
    # @note Updated 2021-03-01.
    # """
    koopa::assert_has_no_args "$#"
    koopa::_pkg_config_version 'cairo'
}

koopa::current_bcbio_version() { # {{{1
    # """
    # Get the latest bcbio-nextgen stable release version.
    # @note Updated 2020-06-30.
    #
    # This approach checks for latest stable release available via bioconda.
    # """
    local url x
    koopa::assert_has_no_args "$#"
    koopa::assert_is_installed curl
{'fraction_non_alphanumeric': 0.1696071512585274, 'fraction_numerical': 0.03904963537991061, 'mean_word_length': 2.5581589958158997, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 2, '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': '2489043', 'n_tokens_mistral': 1727, 'n_tokens_neox': 1517, 'n_words': 331}