| 1 |
_hexdump_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 |
'-L'|'--color') |
| 9 |
COMPREPLY=( $(compgen -W "auto never always" -- $cur) ) |
| 10 |
return 0 |
| 11 |
;; |
| 12 |
'-e'|'--format') |
| 13 |
COMPREPLY=( $(compgen -W "format" -- $cur) ) |
| 14 |
return 0 |
| 15 |
;; |
| 16 |
'-n'|'--length') |
| 17 |
COMPREPLY=( $(compgen -W "length" -- $cur) ) |
| 18 |
return 0 |
| 19 |
;; |
| 20 |
'-s'|'--skip') |
| 21 |
COMPREPLY=( $(compgen -W "offset" -- $cur) ) |
| 22 |
return 0 |
| 23 |
;; |
| 24 |
'-V'|'--version'|'-h'|'--help') |
| 25 |
return 0 |
| 26 |
;; |
| 27 |
esac |
| 28 |
case $cur in |
| 29 |
-*) |
| 30 |
OPTS=" --one-byte-octal |
| 31 |
--one-byte-hex |
| 32 |
--one-byte-char |
| 33 |
--canonical |
| 34 |
--two-bytes-decimal |
| 35 |
--two-bytes-octal |
| 36 |
--two-bytes-hex |
| 37 |
--color= |
| 38 |
--format |
| 39 |
--format-file |
| 40 |
--length |
| 41 |
--skip |
| 42 |
--no-squeezing |
| 43 |
--version |
| 44 |
--help" |
| 45 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 46 |
return 0 |
| 47 |
;; |
| 48 |
esac |
| 49 |
local IFS=$'\n' |
| 50 |
compopt -o filenames |
| 51 |
COMPREPLY=( $(compgen -f -- $cur) ) |
| 52 |
return 0 |
| 53 |
} |
| 54 |
complete -F _hexdump_module hexdump |