mirror of https://github.com/tLDP/LDP
28 lines
816 B
Plaintext
28 lines
816 B
Plaintext
# file: UseGetOpt-2
|
|
# UseGetOpt-2.sh parameter-completion
|
|
|
|
_UseGetOpt-2 () # By convention, the function name
|
|
{ #+ starts with an underscore.
|
|
local cur
|
|
# Pointer to current completion word.
|
|
# By convention, it's named "cur" but this isn't strictly necessary.
|
|
|
|
COMPREPLY=() # Array variable storing the possible completions.
|
|
cur=${COMP_WORDS[COMP_CWORD]}
|
|
|
|
case "$cur" in
|
|
-*)
|
|
COMPREPLY=( $( compgen -W '-a -d -f -l -t -h --aoption --debug \
|
|
--file --log --test --help --' -- $cur ) );;
|
|
# Generate the completion matches and load them into $COMPREPLY array.
|
|
# xx) May add more cases here.
|
|
# yy)
|
|
# zz)
|
|
esac
|
|
|
|
return 0
|
|
}
|
|
|
|
complete -F _UseGetOpt-2 -o filenames ./UseGetOpt-2.sh
|
|
# ^^ ^^^^^^^^^^^^ Invokes the function _UseGetOpt-2.
|