| 1 |
_pg_module() |
| 2 |
{ |
| 3 |
local cur prev OPTS |
| 4 |
COMPREPLY=() |
| 5 |
cur="${COMP_WORDS[COMP_CWORD]}" |
| 6 |
prev="${COMP_WORDS[COMP_CWORD-1]}" |
| 7 |
case $prev in |
| 8 |
'-p') |
| 9 |
COMPREPLY=( $(compgen -W "prompt" -- $cur) ) |
| 10 |
return 0 |
| 11 |
;; |
| 12 |
'-h'|'-V') |
| 13 |
return 0 |
| 14 |
;; |
| 15 |
esac |
| 16 |
case $cur in |
| 17 |
-*) |
| 18 |
OPTS="-number -c -e -f -n -p -r -s -h -V --help --version" |
| 19 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 20 |
return 0 |
| 21 |
;; |
| 22 |
+*) |
| 23 |
OPTS="+number +/pattern/" |
| 24 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 25 |
return 0 |
| 26 |
;; |
| 27 |
esac |
| 28 |
local IFS=$'\n' |
| 29 |
compopt -o filenames |
| 30 |
COMPREPLY=( $(compgen -f -- $cur) ) |
| 31 |
return 0 |
| 32 |
} |
| 33 |
complete -F _pg_module pg |