summaryrefslogtreecommitdiff
path: root/dev-vcs/git-annex/files/git-annex.bash
blob: 309b221f0157b70643e5f845a335c3549eb4f32f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
_git_annex()
{
    local cmdline
    local IFS=$'
'
    CMDLINE=(--bash-completion-index $COMP_CWORD)

    if [[ "${COMP_WORDS[@]:0:2}" == "git annex" ]]; then
        unset COMP_WORDS[0]
        COMP_WORDS[1]="git-annex"
    fi
    for arg in ${COMP_WORDS[@]}; do
        CMDLINE=(${CMDLINE[@]} --bash-completion-word $arg)
    done

    COMPREPLY=( $(/usr/bin/git-annex "${CMDLINE[@]}") )
}

complete -o filenames -F _git_annex git-annex