aboutsummaryrefslogtreecommitdiff
path: root/examples/bash_completion.sh
blob: 54937ad6252eb15efcbc30b7bb7d83d9496c9c9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
_args() {
    _init_completion -n 2> /dev/null
    local program comparg

    program="${COMP_WORDS[0]}"
    comparg="--complete" # replace this with your flag

    COMPREPLY=($("$program" "$comparg" bash "$COMP_CWORD" "${COMP_WORDS[@]}" 2> /dev/null))
    [[ $COMPREPLY ]] && return
    _filedir
}

complete -F _args completion