5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
10 # /proc/locks can have 8 to 9 fields, see commit
11 # 55c0d16bab8cc84b72bf11cb2fdd8aa6205ac608
12 PIDS="$(awk '{print $(NF-3)}' /proc/locks)"
13 COMPREPLY=( $(compgen -W "$PIDS" -- $cur) )
17 local prefix realcur OUTPUT_ALL OUTPUT
19 prefix="${cur%$realcur}"
20 OUTPUT_ALL="COMMAND PID TYPE SIZE MODE M START END PATH BLOCKER"
21 for WORD in $OUTPUT_ALL; do
22 if ! [[ $prefix == *"$WORD"* ]]; then
23 OUTPUT="$WORD ${OUTPUT:-""}"
27 COMPREPLY=( $(compgen -P "$prefix" -W "$OUTPUT" -S ',' -- $realcur) )
30 '-h'|'--help'|'-V'|'--version')
46 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
50 complete -F _lslocks_module lslocks