# shellcheck shell=bash

# Tox environment name -> Python executable name (e.g. py312-m_mtg -> python3.12)
toxenv-python() {
    local pattern='^py([23])([0-9]{1,2}).*'
    if [[ $1 =~ $pattern ]]; then
        echo "python${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
        return
    else
        echo "${FUNCNAME[0]}: $1: environment name not recognised" >&2
        return 1
    fi
}
