File: bash_completion.sh

package info (click to toggle)
libargs 6.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 1,212 kB
  • sloc: cpp: 15,120; makefile: 56; sh: 19; python: 12
file content (13 lines) | stat: -rw-r--r-- 329 bytes parent folder | download | duplicates (6)
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