whusnoopy
7/17/2014 - 8:08 AM

fabric auto complete builder

fabric auto complete builder

# source this file before use fab
# copy from github.com/jjanyan/joshix and modified

_fab_completion() {
    COMPREPLY=()

    # Fabfile in this folder?
    [[ -e fabfile.py ]] || [[ -e fabfile/__init__.py ]] || return 0

    local cur="${COMP_WORDS[COMP_CWORD]}"

    tasks=$(fab --shortlist)
    COMPREPLY=( $(compgen -W "${tasks}" -- ${cur}) )
}

complete -F _fab_completion fab