These have user supplied arguments to determine how the list of completions is to be made up:
-k
arrayNames taken from the elements of $
array (note that the ‘$
’
does not appear on the command line).
Alternatively, the argument array itself may be a set
of space- or comma-separated values in parentheses, in which any
delimiter may be escaped with a backslash; in this case the argument
should be quoted. For example,
compctl -k "(cputime filesize datasize stacksize coredumpsize resident descriptors)" limit
-g
globstringThe globstring is expanded using filename globbing; it should be
quoted to protect it from immediate expansion. The resulting
filenames are taken as the possible completions. Use ‘*(/)
’ instead of
‘*/
’ for directories. The fignore
special parameter is not
applied to the resulting files. More than one pattern may be given
separated by blanks. (Note that brace expansion is not part of
globbing. Use the syntax ‘(either|or)
’ to match alternatives.)
-s
subststringThe subststring is split into words and these words are than
expanded using all shell expansion mechanisms (see
Expansion). The resulting words are taken as possible
completions. The fignore
special parameter is not applied to the
resulting files. Note that -g
is faster for filenames.
-K
function ¶Call the given function to get the completions. Unless the name
starts with an underscore, the function is
passed two arguments: the prefix and the suffix of the word on which
completion is to be attempted, in other words those characters before
the cursor position, and those from the cursor position onwards. The
whole command line can be accessed with the -c
and -l
flags
of the read
builtin. The
function should set the variable reply
to an array containing
the completions (one completion per element); note that reply
should not be made local to the function. From such a function the
command line can be accessed with the -c
and -l
flags to
the read
builtin. For example,
function whoson { reply=(`users`); } compctl -K whoson talk
completes only logged-on users after ‘talk
’. Note that ‘whoson
’ must
return an array, so ‘reply=`users`
’ would be incorrect.
-H
num patternThe possible completions are taken from the last num history
lines. Only words matching pattern are taken. If num is
zero or negative the whole history is searched and if pattern is
the empty string all words are taken (as with ‘*
’). A typical
use is
compctl -D -f + -H 0 {No value for `dsq'}
which forces completion to look back in the history list for a word if no filename matches.