| 1 |
_blkpr_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 |
'-c'|'--command') |
| 9 |
COMPREPLY=( $(compgen -W "register reserve release preempt preempt-abort clear" -- $cur) ) |
| 10 |
return 0 |
| 11 |
;; |
| 12 |
'-t'|'--type') |
| 13 |
COMPREPLY=( $(compgen -W "write-exclusive exclusive-access write-exclusive-reg-only exclusive-access-reg-only write-exclusive-all-regs exclusive-access-all-regs" -- $cur) ) |
| 14 |
return 0 |
| 15 |
;; |
| 16 |
'-f'|'--flag') |
| 17 |
COMPREPLY=( $(compgen -W "ignore-key" -- $cur) ) |
| 18 |
return 0 |
| 19 |
;; |
| 20 |
'-k'|'--key'|'-K'|'--oldkey') |
| 21 |
COMPREPLY=( $(compgen -W "num" -- $cur) ) |
| 22 |
return 0 |
| 23 |
;; |
| 24 |
'-h'|'--help'|'-V'|'--version') |
| 25 |
return 0 |
| 26 |
;; |
| 27 |
esac |
| 28 |
case $cur in |
| 29 |
-*) |
| 30 |
OPTS=" |
| 31 |
--command |
| 32 |
--key |
| 33 |
--oldkey |
| 34 |
--flag |
| 35 |
--type |
| 36 |
--help |
| 37 |
--version |
| 38 |
" |
| 39 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 40 |
return 0 |
| 41 |
;; |
| 42 |
esac |
| 43 |
compopt -o bashdefault -o default |
| 44 |
COMPREPLY=( $(compgen -W "$(command lsblk -pnro name)" -- $cur) ) |
| 45 |
return 0 |
| 46 |
} |
| 47 |
complete -F _blkpr_module blkpr |