All Downloads are FREE. Search and download functionalities are using the official Maven repository.

halyard.halyard-cli.1.67.0.source-code.hal-completor-body Maven / Gradle / Ivy

# halyard-cli command completion

_hal() {
    local cur prev ptr
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    if [[ "${prev}" == -* ]]; then
        local options sublen
        if [ -z "${cur}" ]; then
            # strip just the --flag from the query
            sublen=$(($COMP_CWORD - 1))
        else
            # strip the --flag and value from the query
            sublen=$(($COMP_CWORD - 2))
        fi

        options=$( ${COMP_WORDS[@]:0:$sublen} --options $prev --color false --quiet )

        if [ "$?" = "0" ]; then
            COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )
            return 0
        fi
    fi

{%body%}
}

complete -F _hal hal




© 2015 - 2025 Weber Informatics LLC | Privacy Policy