| 1 |
# file: UseGetOpt-2 |
| 2 |
# UseGetOpt-2.sh parameter-completion |
| 3 |
|
| 4 |
_UseGetOpt-2 () # By convention, the function name |
| 5 |
{ #+ starts with an underscore. |
| 6 |
local cur |
| 7 |
# Pointer to current completion word. |
| 8 |
# By convention, it's named "cur" but this isn't strictly necessary. |
| 9 |
|
| 10 |
COMPREPLY=() # Array variable storing the possible completions. |
| 11 |
cur=${COMP_WORDS[COMP_CWORD]} |
| 12 |
|
| 13 |
case "$cur" in |
| 14 |
-*) |
| 15 |
COMPREPLY=( $( compgen -W '-a -d -f -l -t -h --aoption --debug \ |
| 16 |
--file --log --test --help --' -- $cur ) );; |
| 17 |
# Generate the completion matches and load them into $COMPREPLY array. |
| 18 |
# xx) May add more cases here. |
| 19 |
# yy) |
| 20 |
# zz) |
| 21 |
esac |
| 22 |
|
| 23 |
return 0 |
| 24 |
} |
| 25 |
|
| 26 |
complete -F _UseGetOpt-2 -o filenames ./UseGetOpt-2.sh |
| 27 |
# ^^ ^^^^^^^^^^^^ Invokes the function _UseGetOpt-2. |