# Part of eQual. See LICENSE file for full copyright and licensing details.

# Bash autocompletion bootstrap for eQual.
# This script uses the operation invocation logic and the controllers announcements
#    to provide interactive help while composing CLI commands.
# To install this script, copy it to /etc/bash_completion.d/
# and activate with `source /etc/bash_completion.d/autocomplete`

_equal_completion()
{
    script='/var/www/html/autocomplete.php'
    if [[ "$OSTYPE" =~ ^msys ]]; then
        alias php='php.exe'
        script='autocomplete.php'
    fi
    local cur
    COMPREPLY=()
    cur=${COMP_WORDS[*]}
    COMPREPLY=( $(php $script "$cur") )
    return 0
}
complete -o nospace -F _equal_completion "equal.run"
